svghmi/widget_jump.ysl2
branchsvghmi
changeset 2898 a2910281fcb5
parent 2883 8e3d130399b0
child 2900 3ef217f525ff
equal deleted inserted replaced
2897:bf8a39cc65e4 2898:a2910281fcb5
     1 // widget_jump.ysl2
     1 // widget_jump.ysl2
     2 
     2 
     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     |     on_click: function(evt) {
     5     |     on_click: function(evt) {
     6     |         switch_page(this.args[0], this.indexes[0]);
     6     |         const index = this.indexes.length > 0 ? this.indexes[0] + this.offset : undefined;
       
     7     |         switch_page(this.args[0], index);
     7     |     },
     8     |     },
     8     |     init: function() {
     9     |     init: function() {
     9     /* registering event this way doies not "click" through svg:use 
    10     /* registering event this way doies not "click" through svg:use 
    10     |     this.element.onclick = evt => switch_page(this.args[0]);
    11     |     this.element.onclick = evt => switch_page(this.args[0]);
    11     event must be registered by adding attribute to element instead
    12     event must be registered by adding attribute to element instead