SVGHMI: allow widgets to disable clipping on variables given with min and max. Setting this.clip = false disables clipping.
authorEdouard Tisserant
Thu, 05 May 2022 10:35:29 +0200
changeset 3453 e5967a2ae2bb
parent 3452 a0bd2c4cb8f7
child 3454 0b5ab53007a9
SVGHMI: allow widgets to disable clipping on variables given with min and max. Setting this.clip = false disables clipping.
svghmi/widgets_common.ysl2
--- a/svghmi/widgets_common.ysl2	Thu May 05 10:31:16 2022 +0200
+++ b/svghmi/widgets_common.ysl2	Thu May 05 10:35:29 2022 +0200
@@ -183,6 +183,7 @@
             this.pending = indexes.map(() => undefined);
             this.bound_unhinibit = this.unhinibit.bind(this);
             this.forced_frequency = freq;
+            this.clip = true;
         }
 
         unsub(){
@@ -269,14 +270,16 @@
             if(realindex == undefined) return undefined;
             let old_val = cache[realindex];
             let new_val = eval_operation_string(old_val, opstr);
-            new_val = this.clip_min_max(index, new_val);
+            if(this.clip)
+                new_val = this.clip_min_max(index, new_val);
             return apply_hmi_value(realindex, new_val);
         }
 
         _apply_hmi_value(index, new_val) {
             let realindex = this.get_variable_index(index);
             if(realindex == undefined) return undefined;
-            new_val = this.clip_min_max(index, new_val);
+            if(this.clip)
+                new_val = this.clip_min_max(index, new_val);
             return apply_hmi_value(realindex, new_val);
         }