SVGHMI: Make ScrollBar's variables order match JsonTable's variables order to avoid confusion svghmi
authorEdouard Tisserant
Wed, 03 Mar 2021 11:45:13 +0100
branchsvghmi
changeset 3178 21cb76012c78
parent 3175 b2ba6eeb61ec
child 3179 73d26eae5fb1
child 3182 a7941f053a83
SVGHMI: Make ScrollBar's variables order match JsonTable's variables order to avoid confusion
svghmi/gen_index_xhtml.xslt
svghmi/widget_scrollbar.ysl2
tests/svghmi/svghmi_0@svghmi/svghmi.svg
--- a/svghmi/gen_index_xhtml.xslt	Tue Mar 02 17:30:13 2021 +0100
+++ b/svghmi/gen_index_xhtml.xslt	Wed Mar 03 11:45:13 2021 +0100
@@ -5748,22 +5748,22 @@
 </xsl:text>
     <xsl:text>            case 0:
 </xsl:text>
+    <xsl:text>                this.range = Math.max(1,value);
+</xsl:text>
+    <xsl:text>                break;
+</xsl:text>
+    <xsl:text>            case 1:
+</xsl:text>
     <xsl:text>                this.position = value;
 </xsl:text>
     <xsl:text>                break;
 </xsl:text>
-    <xsl:text>            case 1:
-</xsl:text>
-    <xsl:text>                this.range = Math.max(1,value);
+    <xsl:text>            case 2:
+</xsl:text>
+    <xsl:text>                this.size = value;
 </xsl:text>
     <xsl:text>                break;
 </xsl:text>
-    <xsl:text>            case 2:
-</xsl:text>
-    <xsl:text>                this.size = value;
-</xsl:text>
-    <xsl:text>                break;
-</xsl:text>
     <xsl:text>        }
 </xsl:text>
     <xsl:text>
@@ -5834,7 +5834,7 @@
 </xsl:text>
     <xsl:text>        this.position = Math.round(Math.max(Math.min(position, this.range - this.size), 0));
 </xsl:text>
-    <xsl:text>        this.apply_hmi_value(0, this.position);
+    <xsl:text>        this.apply_hmi_value(1, this.position);
 </xsl:text>
     <xsl:text>    }
 </xsl:text>
--- a/svghmi/widget_scrollbar.ysl2	Tue Mar 02 17:30:13 2021 +0100
+++ b/svghmi/widget_scrollbar.ysl2	Wed Mar 03 11:45:13 2021 +0100
@@ -12,10 +12,10 @@
         dispatch(value,oldval, index) {
             switch(index) {
                 case 0:
-                    this.position = value;
+                    this.range = Math.max(1,value);
                     break;
                 case 1:
-                    this.range = Math.max(1,value);
+                    this.position = value;
                     break;
                 case 2:
                     this.size = value;
@@ -55,7 +55,7 @@
 
         apply_position(position){
             this.position = Math.round(Math.max(Math.min(position, this.range - this.size), 0));
-            this.apply_hmi_value(0, this.position);
+            this.apply_hmi_value(1, this.position);
         }
 
         on_page_click(is_up){
--- a/tests/svghmi/svghmi_0@svghmi/svghmi.svg	Tue Mar 02 17:30:13 2021 +0100
+++ b/tests/svghmi/svghmi_0@svghmi/svghmi.svg	Wed Mar 03 11:45:13 2021 +0100
@@ -125,11 +125,11 @@
      inkscape:pageopacity="0"
      inkscape:pageshadow="2"
      inkscape:document-units="px"
-     inkscape:current-layer="g971"
+     inkscape:current-layer="hmi0"
      showgrid="false"
      units="px"
      inkscape:zoom="0.42177816"
-     inkscape:cx="-596.64145"
+     inkscape:cx="-871.66754"
      inkscape:cy="136.19693"
      inkscape:window-width="1600"
      inkscape:window-height="836"
@@ -5406,7 +5406,7 @@
   </g>
   <g
      id="g1766"
-     inkscape:label="HMI:ScrollBar@.position@.range@.visibleAlarms"
+     inkscape:label="HMI:ScrollBar@.range@.position@.visibleAlarms"
      transform="translate(9.7583007e-6)">
     <path
        sodipodi:nodetypes="cccc"
@@ -7084,7 +7084,7 @@
     </g>
   </g>
   <g
-     inkscape:label="HMI:ScrollBar@.position@.range@.visibleAlarms"
+     inkscape:label="HMI:ScrollBar@.range@.position@.visibleAlarms"
      id="g1165"
      transform="translate(-2.4169924e-7,779.99999)">
     <path