# HG changeset patch # User Edouard Tisserant # Date 1585140964 -3600 # Node ID a2910281fcb52a9cc443a954de0a0f627c8a8ed6 # Parent bf8a39cc65e4cc9cf344b367a0eb5efb134d0483 SVGHMI: Alow relative relative Jump. (i.e, relative jump from a foreach widget) diff -r bf8a39cc65e4 -r a2910281fcb5 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Wed Mar 25 13:36:04 2020 +0100 +++ b/svghmi/gen_index_xhtml.xslt Wed Mar 25 13:56:04 2020 +0100 @@ -876,7 +876,9 @@ on_click: function(evt) { - switch_page(this.args[0], this.indexes[0]); + const index = this.indexes.length > 0 ? this.indexes[0] + this.offset : undefined; + + switch_page(this.args[0], index); }, diff -r bf8a39cc65e4 -r a2910281fcb5 svghmi/widget_jump.ysl2 --- a/svghmi/widget_jump.ysl2 Wed Mar 25 13:36:04 2020 +0100 +++ b/svghmi/widget_jump.ysl2 Wed Mar 25 13:56:04 2020 +0100 @@ -3,7 +3,8 @@ template "widget[@type='Jump']", mode="widget_defs" { param "hmi_element"; | on_click: function(evt) { - | switch_page(this.args[0], this.indexes[0]); + | const index = this.indexes.length > 0 ? this.indexes[0] + this.offset : undefined; + | switch_page(this.args[0], index); | }, | init: function() { /* registering event this way doies not "click" through svg:use