SVGHMI: widget activable elements : moved code to wher it belongs, rewrote cleaner
--- a/svghmi/svghmi.js Tue Feb 02 16:39:02 2021 +0100
+++ b/svghmi/svghmi.js Thu Feb 04 21:20:01 2021 +0100
@@ -465,17 +465,3 @@
current_modal = undefined;
};
-function widget_active_activable(eltsub) {
- if(eltsub.inactive_style === undefined)
- eltsub.inactive_style = eltsub.inactive.getAttribute("style");
- eltsub.inactive.setAttribute("style", "display:none");
- if(eltsub.active_style !== undefined)
- eltsub.active.setAttribute("style", eltsub.active_style);
-};
-function widget_inactive_activable(eltsub) {
- if(eltsub.active_style === undefined)
- eltsub.active_style = eltsub.active.getAttribute("style");
- eltsub.active.setAttribute("style", "display:none");
- if(eltsub.inactive_style !== undefined)
- eltsub.inactive.setAttribute("style", eltsub.inactive_style);
-};
--- a/svghmi/widget_keypad.ysl2 Tue Feb 02 16:39:02 2021 +0100
+++ b/svghmi/widget_keypad.ysl2 Thu Feb 04 21:20:01 2021 +0100
@@ -103,11 +103,11 @@
}
if(this.Shift_sub && this.shift != this._shift){
this._shift = this.shift;
- (this.shift?widget_active_activable:widget_inactive_activable)(this.Shift_sub);
+ (this.shift?this.activate_activable:this.inactivate_activable)(this.Shift_sub);
}
if(this.CapsLock_sub && this.caps != this._caps){
this._caps = this.caps;
- (this.caps?widget_active_activable:widget_inactive_activable)(this.CapsLock_sub);
+ (this.caps?this.activate_activable:this.inactivate_activable)(this.CapsLock_sub);
}
}
}
--- a/svghmi/widgets_common.ysl2 Tue Feb 02 16:39:02 2021 +0100
+++ b/svghmi/widgets_common.ysl2 Thu Feb 04 21:20:01 2021 +0100
@@ -251,6 +251,16 @@
}
}
+
+ activate_activable(eltsub) {
+ eltsub.inactive.style.display = "none";
+ eltsub.active.style.display = "";
+ }
+
+ inactivate_activable(eltsub) {
+ eltsub.active.style.display = "none";
+ eltsub.inactive.style.display = "";
+ }
}
||
}