svghmi/widget_jump.ysl2
branchsvghmi
changeset 2902 1fcb50af0335
parent 2901 3f5194bba67d
child 2903 881d0248b3ce
equal deleted inserted replaced
2901:3f5194bba67d 2902:1fcb50af0335
     3 template "widget[@type='Jump']", mode="widget_defs" {
     3 template "widget[@type='Jump']", mode="widget_defs" {
     4     param "hmi_element";
     4     param "hmi_element";
     5 
     5 
     6     |     on_click: function(evt) {
     6     |     on_click: function(evt) {
     7     |         const index = this.indexes.length > 0 ? this.indexes[0] + this.offset : undefined;
     7     |         const index = this.indexes.length > 0 ? this.indexes[0] + this.offset : undefined;
     8     |         switch_page(this.args[0], index);
     8     |         const name = this.args[0];
       
     9     |         switch_page(name, index);
     9     |     },
    10     |     },
    10     |     init: function() {
    11     |     init: function() {
    11     /* registering event this way does not "click" through svg:use 
    12     /* registering event this way does not "click" through svg:use 
    12     |     this.element.onclick = evt => switch_page(this.args[0]);
    13     |     this.element.onclick = evt => switch_page(this.args[0]);
    13     event must be registered by adding attribute to element instead
    14     event must be registered by adding attribute to element instead