--- a/svghmi/widget_tooglebutton.ysl2 Wed Aug 31 12:16:09 2022 +0200
+++ b/svghmi/widget_tooglebutton.ysl2 Fri Sep 02 10:46:05 2022 +0200
@@ -18,33 +18,27 @@
widget_class("ToggleButton") {
||
frequency = 5;
- state = 0;
active_style = undefined;
inactive_style = undefined;
dispatch(value) {
- this.state = value;
+ this.actvity_state = Boolean(value);
//redraw toggle button
this.request_animate();
}
on_click(evt) {
//toggle state and apply
- this.state = this.state ? false : true;
- this.apply_hmi_value(0, this.state);
+ this.activity_state = this.activity_state ? false : true;
+ this.apply_hmi_value(0, this.activity_state);
//redraw toggle button
this.request_animate();
}
- animate(){
- // redraw toggle button on screen refresh
- this.set_activation_state(this.state);
- }
-
init() {
this.element.onclick = (evt) => this.on_click(evt);
- this.set_activation_state(undefined);
+ this.activity_state = undefined;
}
||
}