edouard@2883: // widget_jump.ysl2 Edouard@2779: edouard@2883: template "widget[@type='Jump']", mode="widget_defs" { edouard@2883: param "hmi_element"; edouard@2883: | on_click: function(evt) { edouard@2883: | switch_page(this.args[0], this.indexes[0]); edouard@2883: | }, edouard@2883: | init: function() { edouard@2883: /* registering event this way doies not "click" through svg:use edouard@2883: | this.element.onclick = evt => switch_page(this.args[0]); edouard@2883: event must be registered by adding attribute to element instead edouard@2883: TODO : generalize mouse event handling by global event capture + getElementsAtPoint() edouard@2883: */ edouard@2883: | this.element.setAttribute("onclick", "hmi_widgets['«$hmi_element/@id»'].on_click(evt)"); edouard@2883: | }, Edouard@2753: }