svghmi/widget_button.ysl2
branchsvghmi
changeset 3062 9ec338a99a18
parent 3059 e0db3f6a5f39
child 3085 6b1b23971960
--- a/svghmi/widget_button.ysl2	Wed Sep 30 12:31:59 2020 +0200
+++ b/svghmi/widget_button.ysl2	Thu Oct 01 14:23:27 2020 +0200
@@ -25,13 +25,15 @@
         }
 
         animate(){
-           // redraw button on screen refresh
-           if (this.state_hmi) {
-               this.active_elt.setAttribute("style", this.active_style);
-               this.inactive_elt.setAttribute("style", "display:none");
-           } else {
-               this.inactive_elt.setAttribute("style", this.inactive_style);
-               this.active_elt.setAttribute("style", "display:none");
+            if (this.active_style && this.inactive_style) {
+               // redraw button on screen refresh
+               if (this.state_hmi) {
+                   this.active_elt.setAttribute("style", this.active_style);
+                   this.inactive_elt.setAttribute("style", "display:none");
+               } else {
+                   this.inactive_elt.setAttribute("style", this.inactive_style);
+                   this.active_elt.setAttribute("style", "display:none");
+               }
            }
         }