SVGHMI: fixed keypad JS regarding shift/capslock and other details svghmi
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Sat, 04 Apr 2020 17:47:16 +0200
branchsvghmi
changeset 2919 c6e6051898f5
parent 2918 5cb6ab87b185
child 2920 3ee337c8c769
SVGHMI: fixed keypad JS regarding shift/capslock and other details
svghmi/gen_index_xhtml.xslt
svghmi/widget_keypad.ysl2
--- 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;">
--- 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]";