--- a/svghmi/widget_switch.ysl2 Wed Jun 15 11:46:48 2022 +0200
+++ b/svghmi/widget_switch.ysl2 Mon Jun 20 09:19:56 2022 +0200
@@ -43,7 +43,7 @@
if(choice.parent != undefined){
- choice.parent.appendChild(choice.elt);
+ choice.parent.insertBefore(choice.elt,choice.sibling); choice.parent = undefined;
@@ -60,11 +60,21 @@
const "subwidgets", "$subelts//*[@id = $hmi_widgets/@id]";
const "accepted", "$subelts[not(ancestor-or-self::*/@id = $subwidgets/@id)]";
- foreach "$accepted[regexp:test(@inkscape:label,$regex)]" {
+ const "choices", "$accepted[regexp:test(@inkscape:label,$regex)]"; const "literal", "regexp:match(@inkscape:label,$regex)[2]";
+ const "sibling", "following-sibling::*[not(@id = $choices/@id)][position()=1]"; + when "count($sibling)=0" { + | sibling:id("«$sibling/@id»"), | }`if "position()!=last()" > ,`
--- a/tests/projects/svghmi/svghmi_0@svghmi/svghmi.svg Wed Jun 15 11:46:48 2022 +0200
+++ b/tests/projects/svghmi/svghmi_0@svghmi/svghmi.svg Mon Jun 20 09:19:56 2022 +0200
@@ -125,12 +125,12 @@
inkscape:document-units="px"
- inkscape:current-layer="hmi0"
+ inkscape:current-layer="g5053" - inkscape:zoom="0.20046201"
- inkscape:cx="1401.1703"
- inkscape:cy="-1495.7332"
+ inkscape:zoom="0.80184804" + inkscape:cx="784.66046" + inkscape:cy="-449.34319" inkscape:window-width="1600"
inkscape:window-height="836"
@@ -2244,6 +2244,42 @@
inkscape:label="HMI:Switch@/PUMP0/BOOLOUT"
transform="translate(43.983597,40.477445)">
+ style="fill:#ff0000;stroke:#ff00ff" + transform="rotate(90,931.73133,997.97991)"> + inkscape:connector-curvature="0" + style="fill:#353564;fill-rule:evenodd;stroke:none;stroke-linejoin:round" + d="M 825.90067,963.24473 V 1105.042 L 960.08282,916.47893 V 809.26931 Z" /> + inkscape:connector-curvature="0" + style="fill:#afafde;fill-rule:evenodd;stroke:none;stroke-linejoin:round" + d="m 825.90067,1105.042 90.50966,81.6485 121.15167,-225.30346 -77.47918,-44.90811 z" /> + inkscape:connector-curvature="0" + style="fill:#e9e9ff;fill-rule:evenodd;stroke:none;stroke-linejoin:round" + d="m 960.08282,809.26931 77.47918,36.25625 v 115.86148 l -77.47918,-44.90811 z" /> + inkscape:connector-curvature="0" + style="fill:#4d4d9f;fill-rule:evenodd;stroke:none;stroke-linejoin:round" + d="M 825.90067,963.24473 916.41033,1029.3537 1037.562,845.52556 960.08282,809.26931 Z" /> + inkscape:connector-curvature="0" + style="fill:#d7d7ff;fill-rule:evenodd;stroke:none;stroke-linejoin:round" + d="m 916.41033,1029.3537 v 157.3368 L 1037.562,961.38704 V 845.52556 Z" /> + inkscape:connector-curvature="0" + style="fill:#8686bf;fill-rule:evenodd;stroke:none;stroke-linejoin:round" + d="m 825.90067,963.24473 90.50966,66.10897 v 157.3368 l -90.50966,-81.6485 z" /> style="fill:#ff0000;stroke:#ff00ff"
@@ -2278,6 +2314,15 @@
inkscape:connector-curvature="0" />
+ style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:#ff8080;stroke-width:3.77952766;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" style="fill:#ff0000;stroke:#ff00ff"