# HG changeset patch # User Edouard Tisserant # Date 1617006381 -7200 # Node ID 4fd7bd10e606cf872f8bfe790ce3c38da707c3a4 # Parent 62753288be743ce127a1b08dfa24f6a9720f8b16 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page diff -r 62753288be74 -r 4fd7bd10e606 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Fri Mar 26 14:53:35 2021 +0100 +++ b/svghmi/gen_index_xhtml.xslt Mon Mar 29 10:26:21 2021 +0200 @@ -44,8 +44,6 @@ /* - - */ " " @@ -59,6 +57,24 @@ + var hmitree_paths = [ + + + /* + + */ " + + " + + , + + + + + ]; + + + @@ -3052,9 +3068,7 @@ function sprintf(key) { - // - - is not an array, but should be fine for this call + // arguments is not an array, but should be fine for this call return sprintf_format(sprintf_parse(key), arguments) @@ -7603,6 +7617,8 @@ var current_page_index; + var page_node_local_index = hmi_local_index("page_node"); + function prepare_svg() { @@ -7701,6 +7717,20 @@ current_page_index = page_index; + let page_node; + + if(page_index != undefined){ + + page_node = hmitree_paths[page_index]; + + }else{ + + page_node = ""; + + } + + apply_hmi_value(page_node_local_index, page_node); + jumps_need_update = true; diff -r 62753288be74 -r 4fd7bd10e606 svghmi/svghmi.js --- a/svghmi/svghmi.js Fri Mar 26 14:53:35 2021 +0100 +++ b/svghmi/svghmi.js Mon Mar 29 10:26:21 2021 +0200 @@ -359,6 +359,7 @@ var current_visible_page; var current_subscribed_page; var current_page_index; +var page_node_local_index = hmi_local_index("page_node"); function prepare_svg() { // prevents context menu from appearing on right click and long touch @@ -408,6 +409,13 @@ current_subscribed_page = page_name; current_page_index = page_index; + let page_node; + if(page_index != undefined){ + page_node = hmitree_paths[page_index]; + }else{ + page_node = ""; + } + apply_hmi_value(page_node_local_index, page_node); jumps_need_update = true; diff -r 62753288be74 -r 4fd7bd10e606 tests/svghmi/svghmi_0@svghmi/svghmi.svg --- a/tests/svghmi/svghmi_0@svghmi/svghmi.svg Fri Mar 26 14:53:35 2021 +0100 +++ b/tests/svghmi/svghmi_0@svghmi/svghmi.svg Mon Mar 29 10:26:21 2021 +0200 @@ -128,12 +128,12 @@ inkscape:current-layer="hmi0" showgrid="false" units="px" - inkscape:zoom="1.6871126" - inkscape:cx="-820.55411" - inkscape:cy="162.70697" - inkscape:window-width="3840" - inkscape:window-height="2096" - inkscape:window-x="1600" + inkscape:zoom="0.42177815" + inkscape:cx="1614.7137" + inkscape:cy="168.68416" + inkscape:window-width="1600" + inkscape:window-height="836" + inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" showguides="true" @@ -6021,7 +6021,7 @@ sodipodi:role="line">filter + inkscape:label="HMI:VarInit:"POS"@.filter" /> + page node