svghmi/widget_customhtml.ysl2
author Edouard Tisserant <edouard.tisserant@gmail.com>
Mon, 03 May 2021 00:06:03 +0200
branchsvghmi
changeset 3236 e4e27c4efb96
parent 3232 7bdb766c2a4d
child 3241 fe945f1f48b7
permissions -rw-r--r--
SVGHMI: Extend widget labels parsing to allow expressing widget's accepted types in labels
// widget_customhtml.ysl2

widget_class("CustomHtml"){
    ||
        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>';
        }
    ||
}


widget_defs("CustomHtml") {
    param "hmi_element";
    labels("container code");
}