# HG changeset patch # User Edouard Tisserant <edouard.tisserant@gmail.com> # Date 1586015236 -7200 # Node ID c6e6051898f587b66a5246414584d11248c0fabb # Parent 5cb6ab87b1854e03f39c589e625044af30c41da1 SVGHMI: fixed keypad JS regarding shift/capslock and other details diff -r 5cb6ab87b185 -r c6e6051898f5 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Sat Apr 04 09:41:32 2020 +0200 +++ b/svghmi/gen_index_xhtml.xslt Sat Apr 04 17:47:16 2020 +0200 @@ -1233,9 +1233,9 @@ </xsl:text> <xsl:text> var syms = symbols.split(" "); </xsl:text> - <xsl:text> this.shift = this.caps; -</xsl:text> - <xsl:text> this.editstr += syms[this.shift?syms.length:0]; + <xsl:text> this.shift |= this.caps; +</xsl:text> + <xsl:text> this.editstr += syms[this.shift?syms.length-1:0]; </xsl:text> <xsl:text> this.shift = false; </xsl:text> @@ -1482,7 +1482,6 @@ <xsl:comment> <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text> </xsl:comment> - <xsl:apply-templates mode="debug_as_comment" select="document('')/*/reflect:*"/> <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml"> <head/> <body style="margin:0;overflow:hidden;"> diff -r 5cb6ab87b185 -r c6e6051898f5 svghmi/widget_keypad.ysl2 --- a/svghmi/widget_keypad.ysl2 Sat Apr 04 09:41:32 2020 +0200 +++ b/svghmi/widget_keypad.ysl2 Sat Apr 04 17:47:16 2020 +0200 @@ -15,8 +15,8 @@ | }, | on_key_click: function(symbols) { | var syms = symbols.split(" "); - | this.shift = this.caps; - | this.editstr += syms[this.shift?syms.length:0]; + | this.shift |= this.caps; + | this.editstr += syms[this.shift?syms.length-1:0]; | this.shift = false; | this.update(); | console.log(symbols); @@ -45,16 +45,20 @@ | }, | on_Space_click: function() { | this.editstr += " "; + | this.update(); | console.log("Space"); | }, | caps: false, | on_CapsLock_click: function() { | this.caps = !this.caps; + | this.update(); | console.log("CapsLock"); | }, | shift: false, | on_Shift_click: function() { | this.shift = true; + | this.caps = false; + | this.update(); | console.log("Shift"); | }, const "g", "$geometry[@Id = $hmi_element/@id]";