svghmi/widget_customhtml.ysl2
author usveticic
Mon, 19 Oct 2020 09:29:11 +0200
branchsvghmi
changeset 3064 4b44d09c48a7
parent 3062 svghmi/widget_animate.ysl2@9ec338a99a18
child 3232 7bdb766c2a4d
permissions -rw-r--r--
- New widget customHtml which allows to insert block of html code
- widget animate transfered to animaterotation
- widget animate, left to be more customizable
- changes to svghmi_v2/svghmi.svg
// widget_customhtml.ysl2

template "widget[@type='CustomHtml']", mode="widget_class"{
    ||
    class CustomHtmlWidget extends Widget{
        frequency = 5;
        widget_size = undefined;

        dispatch(value) {
            this.request_animate();
        }

        animate(){
        }

        init() {
            this.widget_size = this.container_elt.getBBox();
            this.element.innerHTML ='<foreignObject x="'+
                this.widget_size.x+'" y="'+this.widget_size.y+
                '" width="'+this.widget_size.width+'" height="'+this.widget_size.height+'"> '+
                this.code_elt.textContent+
                ' </foreignObject>';
        }
    }
    ||
}


template "widget[@type='CustomHtml']", mode="widget_defs" {
    param "hmi_element";
    labels("container code");
    |,
}