equal
deleted
inserted
replaced
|
1 // widget_switch.ysl2 |
|
2 |
|
3 template "widget[@type='Switch']", mode="widget_defs" { |
|
4 param "hmi_element"; |
|
5 | frequency: 5, |
|
6 | dispatch: function(value) { |
|
7 | for(let choice of this.choices){ |
|
8 | if(value != choice.value){ |
|
9 | choice.elt.setAttribute("style", "display:none"); |
|
10 | } else { |
|
11 | choice.elt.setAttribute("style", choice.style); |
|
12 | } |
|
13 | } |
|
14 | }, |
|
15 | init: function() { |
|
16 | // Hello Switch |
|
17 | }, |
|
18 | choices: [ |
|
19 const "regex",!"'^(\"[^\"].*\"|\-?[0-9]+)(#.*)?$'"!; |
|
20 foreach "$hmi_element/*[regexp:test(@inkscape:label,$regex)]" { |
|
21 const "literal", "regexp:match(@inkscape:label,$regex)[2]"; |
|
22 | { |
|
23 | elt:id("«@id»"), |
|
24 | style:"«@style»", |
|
25 | value:«$literal» |
|
26 | }`if "position()!=last()" > ,` |
|
27 } |
|
28 | ], |
|
29 } |