author | Edouard Tisserant |
Tue, 02 Feb 2021 11:17:03 +0100 | |
branch | svghmi |
changeset 3122 | 229795c03e11 |
parent 3064 | 4b44d09c48a7 |
child 3232 | 7bdb766c2a4d |
permissions | -rw-r--r-- |
3064
4b44d09c48a7
- New widget customHtml which allows to insert block of html code
usveticic
parents:
3062
diff
changeset
|
1 |
// widget_customhtml.ysl2 |
2944 | 2 |
|
3064
4b44d09c48a7
- New widget customHtml which allows to insert block of html code
usveticic
parents:
3062
diff
changeset
|
3 |
template "widget[@type='CustomHtml']", mode="widget_class"{ |
3009 | 4 |
|| |
3064
4b44d09c48a7
- New widget customHtml which allows to insert block of html code
usveticic
parents:
3062
diff
changeset
|
5 |
class CustomHtmlWidget extends Widget{ |
3009 | 6 |
frequency = 5; |
3064
4b44d09c48a7
- New widget customHtml which allows to insert block of html code
usveticic
parents:
3062
diff
changeset
|
7 |
widget_size = undefined; |
3009 | 8 |
|
3056
827bf284feec
Button, ToggleButton and slider updated. Error to warning when building
usveticic
parents:
3024
diff
changeset
|
9 |
dispatch(value) { |
3059
e0db3f6a5f39
Button and toggle reworked to use animate and dispatch
usveticic
parents:
3058
diff
changeset
|
10 |
this.request_animate(); |
3056
827bf284feec
Button, ToggleButton and slider updated. Error to warning when building
usveticic
parents:
3024
diff
changeset
|
11 |
} |
827bf284feec
Button, ToggleButton and slider updated. Error to warning when building
usveticic
parents:
3024
diff
changeset
|
12 |
|
3059
e0db3f6a5f39
Button and toggle reworked to use animate and dispatch
usveticic
parents:
3058
diff
changeset
|
13 |
animate(){ |
e0db3f6a5f39
Button and toggle reworked to use animate and dispatch
usveticic
parents:
3058
diff
changeset
|
14 |
} |
3009 | 15 |
|
3059
e0db3f6a5f39
Button and toggle reworked to use animate and dispatch
usveticic
parents:
3058
diff
changeset
|
16 |
init() { |
3064
4b44d09c48a7
- New widget customHtml which allows to insert block of html code
usveticic
parents:
3062
diff
changeset
|
17 |
this.widget_size = this.container_elt.getBBox(); |
4b44d09c48a7
- New widget customHtml which allows to insert block of html code
usveticic
parents:
3062
diff
changeset
|
18 |
this.element.innerHTML ='<foreignObject x="'+ |
4b44d09c48a7
- New widget customHtml which allows to insert block of html code
usveticic
parents:
3062
diff
changeset
|
19 |
this.widget_size.x+'" y="'+this.widget_size.y+ |
4b44d09c48a7
- New widget customHtml which allows to insert block of html code
usveticic
parents:
3062
diff
changeset
|
20 |
'" width="'+this.widget_size.width+'" height="'+this.widget_size.height+'"> '+ |
4b44d09c48a7
- New widget customHtml which allows to insert block of html code
usveticic
parents:
3062
diff
changeset
|
21 |
this.code_elt.textContent+ |
4b44d09c48a7
- New widget customHtml which allows to insert block of html code
usveticic
parents:
3062
diff
changeset
|
22 |
' </foreignObject>'; |
3059
e0db3f6a5f39
Button and toggle reworked to use animate and dispatch
usveticic
parents:
3058
diff
changeset
|
23 |
} |
3009 | 24 |
} |
25 |
|| |
|
3024 | 26 |
} |
3009 | 27 |
|
28 |
||
3064
4b44d09c48a7
- New widget customHtml which allows to insert block of html code
usveticic
parents:
3062
diff
changeset
|
29 |
template "widget[@type='CustomHtml']", mode="widget_defs" { |
2976
99c4521bb844
SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents:
2961
diff
changeset
|
30 |
param "hmi_element"; |
3064
4b44d09c48a7
- New widget customHtml which allows to insert block of html code
usveticic
parents:
3062
diff
changeset
|
31 |
labels("container code"); |
3009 | 32 |
|, |
3000
a9a45977bac0
SVGHMI: prefer apply_hmi_value() to change_hmi_value() when possible
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2976
diff
changeset
|
33 |
} |