svghmi/widget_customhtml.ysl2
branchsvghmi
changeset 3064 4b44d09c48a7
parent 3062 9ec338a99a18
child 3232 7bdb766c2a4d
equal deleted inserted replaced
3062:9ec338a99a18 3064:4b44d09c48a7
       
     1 // widget_customhtml.ysl2
       
     2 
       
     3 template "widget[@type='CustomHtml']", mode="widget_class"{
       
     4     ||
       
     5     class CustomHtmlWidget extends Widget{
       
     6         frequency = 5;
       
     7         widget_size = undefined;
       
     8 
       
     9         dispatch(value) {
       
    10             this.request_animate();
       
    11         }
       
    12 
       
    13         animate(){
       
    14         }
       
    15 
       
    16         init() {
       
    17             this.widget_size = this.container_elt.getBBox();
       
    18             this.element.innerHTML ='<foreignObject x="'+
       
    19                 this.widget_size.x+'" y="'+this.widget_size.y+
       
    20                 '" width="'+this.widget_size.width+'" height="'+this.widget_size.height+'"> '+
       
    21                 this.code_elt.textContent+
       
    22                 ' </foreignObject>';
       
    23         }
       
    24     }
       
    25     ||
       
    26 }
       
    27 
       
    28 
       
    29 template "widget[@type='CustomHtml']", mode="widget_defs" {
       
    30     param "hmi_element";
       
    31     labels("container code");
       
    32     |,
       
    33 }