SVGHMI: Fix HMI:DropDown flicker on close. svghmi
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Tue, 14 Apr 2020 19:22:18 +0200
branchsvghmi
changeset 2932 abb995a30088
parent 2931 f51c0e2e0bcb
child 2933 ed3f712a8eef
SVGHMI: Fix HMI:DropDown flicker on close.
svghmi/gen_index_xhtml.xslt
svghmi/widget_dropdown.ysl2
--- a/svghmi/gen_index_xhtml.xslt	Tue Apr 14 17:31:45 2020 +0200
+++ b/svghmi/gen_index_xhtml.xslt	Tue Apr 14 19:22:18 2020 +0200
@@ -991,18 +991,18 @@
 </xsl:text>
     <xsl:text>    close: function(){
 </xsl:text>
+    <xsl:text>        document.removeEventListener("click", this.bound_inhibit_click_elsewhere, true);
+</xsl:text>
     <xsl:text>        this.reset_text();
 </xsl:text>
     <xsl:text>        this.reset_box();
 </xsl:text>
     <xsl:text>        this.element.appendChild(this.button_elt);
 </xsl:text>
+    <xsl:text>        this.opened = false;
+</xsl:text>
     <xsl:text>        this.apply_cache();
 </xsl:text>
-    <xsl:text>        document.removeEventListener("click", this.bound_inhibit_click_elsewhere, true);
-</xsl:text>
-    <xsl:text>        this.opened = false;
-</xsl:text>
     <xsl:text>    },
 </xsl:text>
     <xsl:text>    set_complete_text: function(){
--- a/svghmi/widget_dropdown.ysl2	Tue Apr 14 17:31:45 2020 +0200
+++ b/svghmi/widget_dropdown.ysl2	Tue Apr 14 19:22:18 2020 +0200
@@ -84,12 +84,12 @@
             e.stopPropagation();
     },
     close: function(){
+        document.removeEventListener("click", this.bound_inhibit_click_elsewhere, true);
         this.reset_text();
         this.reset_box();
         this.element.appendChild(this.button_elt);
+        this.opened = false;
         this.apply_cache();
-        document.removeEventListener("click", this.bound_inhibit_click_elsewhere, true);
-        this.opened = false;
     },
     set_complete_text: function(){
         let spans = this.text_elt.children;