# HG changeset patch
# User Edouard Tisserant
# Date 1655891738 -7200
# Node ID 4345b3c9b9def92c6a8ad6aae1b852a5dad09fc7
# Parent b27e501430830419381a5fc0e16984dda618ba86
SVGHMI: update generated XSLT files
diff -r b27e50143083 -r 4345b3c9b9de svghmi/analyse_widget.xslt
--- a/svghmi/analyse_widget.xslt Wed Jun 22 11:48:40 2022 +0200
+++ b/svghmi/analyse_widget.xslt Wed Jun 22 11:55:38 2022 +0200
@@ -263,25 +263,7 @@
animate(){
- if (this.active_elt && this.inactive_elt) {
-
-
- if(this.display == "
-
- ")
-
- this.
-
- _elt.style.display = "";
-
- else
-
- this.
-
- _elt.style.display = "none";
-
-
- }
+ this.set_activation_state(this.display == "active");
}
@@ -291,6 +273,8 @@
this.element.addEventListener("pointerdown", this.onmousedown.bind(this));
+ this.set_activation_state(undefined);
+
}
diff -r b27e50143083 -r 4345b3c9b9de svghmi/gen_index_xhtml.xslt
--- a/svghmi/gen_index_xhtml.xslt Wed Jun 22 11:48:40 2022 +0200
+++ b/svghmi/gen_index_xhtml.xslt Wed Jun 22 11:55:38 2022 +0200
@@ -1458,6 +1458,60 @@
+ function _hide(elt, placeholder){
+
+ if(elt.parentNode != null)
+
+ placeholder.parentNode.removeChild(elt);
+
+ }
+
+ function _show(elt, placeholder){
+
+ placeholder.parentNode.insertBefore(elt, placeholder);
+
+ }
+
+
+
+ function set_activation_state(eltsub, state){
+
+ if(eltsub.active_elt_placeholder == undefined){
+
+ eltsub.active_elt_placeholder = document.createComment("");
+
+ eltsub.active_elt.parentNode.insertBefore(eltsub.active_elt_placeholder, eltsub.active_elt);
+
+ eltsub.inactive_elt_placeholder = document.createComment("");
+
+ eltsub.inactive_elt.parentNode.insertBefore(eltsub.inactive_elt_placeholder, eltsub.inactive_elt);
+
+ }
+
+ (state?_show:_hide)(eltsub.active_elt, eltsub.active_elt_placeholder);
+
+ ((state || state==undefined)?_hide:_show)(eltsub.inactive_elt, eltsub.inactive_elt_placeholder);
+
+ }
+
+
+
+ function activate_activable(eltsub) {
+
+ set_activation_state(eltsub, true);
+
+ }
+
+
+
+ function inactivate_activable(eltsub) {
+
+ set_activation_state(eltsub, false);
+
+ }
+
+
+
class Widget {
offset = 0;
@@ -1950,27 +2004,13 @@
}
-
-
- }
-
-
-
- activate_activable(eltsub) {
-
- eltsub.inactive.style.display = "none";
-
- eltsub.active.style.display = "";
-
- }
-
-
-
- inactivate_activable(eltsub) {
-
- eltsub.active.style.display = "none";
-
- eltsub.inactive.style.display = "";
+ }
+
+
+
+ set_activation_state(state){
+
+ set_activation_state(this.activable_sub, state);
}
@@ -2088,7 +2128,7 @@
"
- ": id("
+ _elt": id("
")
@@ -2605,25 +2645,7 @@
animate(){
- if (this.active_elt && this.inactive_elt) {
-
-
- if(this.display == "
-
- ")
-
- this.
-
- _elt.style.display = "";
-
- else
-
- this.
-
- _elt.style.display = "none";
-
-
- }
+ this.set_activation_state(this.display == "active");
}
@@ -2633,6 +2655,8 @@
this.element.addEventListener("pointerdown", this.onmousedown.bind(this));
+ this.set_activation_state(undefined);
+
}
@@ -2652,13 +2676,16 @@
+ activable_sub:{
+
- active inactive
+ /active /inactive
-
+ }
+
class
@@ -2676,13 +2703,16 @@
+ activable_sub:{
+
- active inactive
+ /active /inactive
-
+ }
+
@@ -5874,7 +5904,7 @@
this._shift = this.shift;
- (this.shift?this.activate_activable:this.inactivate_activable)(this.Shift_sub);
+ set_activation_state(this.Shift_sub, this.shift);
}
@@ -5882,7 +5912,7 @@
this._caps = this.caps;
- (this.caps?this.activate_activable:this.inactivate_activable)(this.CapsLock_sub);
+ set_activation_state(this.CapsLock_sub, this.caps);
}
@@ -7659,7 +7689,7 @@
if(choice.parent != undefined){
- choice.parent.appendChild(choice.elt);
+ choice.parent.insertBefore(choice.elt,choice.sibling);
choice.parent = undefined;
@@ -7682,8 +7712,10 @@
-
+
+
+
{
elt:id("
@@ -7692,6 +7724,18 @@
parent:undefined,
+
+
+ sibling:null,
+
+
+
+ sibling:id("
+
+ "),
+
+
+
value:
@@ -7851,27 +7895,11 @@
- activate(val) {
-
- let [active, inactive] = val ? ["","none"] : ["none", ""];
-
- if (this.active_elt)
-
- this.active_elt.style.display = active;
-
- if (this.inactive_elt)
-
- this.inactive_elt.style.display = inactive;
-
- }
-
-
-
animate(){
// redraw toggle button on screen refresh
- this.activate(this.state);
+ this.set_activation_state(this.state);
}
@@ -7879,10 +7907,10 @@
init() {
- this.activate(false);
-
this.element.onclick = (evt) => this.on_click(evt);
+ this.set_activation_state(undefined);
+
}
}
@@ -7890,13 +7918,16 @@
+ activable_sub:{
+
- active inactive
+ /active /inactive
-
+ }
+