SVGHMI: add "DISCARD:" prefix to force discarding an SVG element
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Tue, 26 Mar 2024 17:08:45 +0100
changeset 3923 77a1846390ef
parent 3919 0ce4b50d1182
child 3924 abaa68df90f4
SVGHMI: add "DISCARD:" prefix to force discarding an SVG element
svghmi/detachable_pages.ysl2
svghmi/gen_index_xhtml.xslt
--- a/svghmi/detachable_pages.ysl2	Wed Mar 20 16:44:29 2024 +0100
+++ b/svghmi/detachable_pages.ysl2	Tue Mar 26 17:08:45 2024 +0100
@@ -78,7 +78,8 @@
 def "func:all_related_elements" {
     param "page";
     const "page_overlapping_geometry", "$overlapping_geometry/elt[@id = $page/@id]/*";
-    const "page_overlapping_elements", "//svg:*[@id = $page_overlapping_geometry/@Id]";
+    const "overlapping_candidates", "//svg:*[not(starts-with((ancestor::svg:g | .) /@inkscape:label, 'DISCARD:'))]";
+    const "page_overlapping_elements", "$overlapping_candidates[@id = $page_overlapping_geometry/@Id]";
     const "page_widgets_elements", """
         $hmi_elements[not(@id=$page/@id)
                       and descendant-or-self::svg:*/@id = $page_overlapping_elements/@id]
--- a/svghmi/gen_index_xhtml.xslt	Wed Mar 20 16:44:29 2024 +0100
+++ b/svghmi/gen_index_xhtml.xslt	Tue Mar 26 17:08:45 2024 +0100
@@ -694,7 +694,8 @@
   <func:function name="func:all_related_elements">
     <xsl:param name="page"/>
     <xsl:variable name="page_overlapping_geometry" select="$overlapping_geometry/elt[@id = $page/@id]/*"/>
-    <xsl:variable name="page_overlapping_elements" select="//svg:*[@id = $page_overlapping_geometry/@Id]"/>
+    <xsl:variable name="overlapping_candidates" select="//svg:*[not(starts-with((ancestor::svg:g | .) /@inkscape:label, 'DISCARD:'))]"/>
+    <xsl:variable name="page_overlapping_elements" select="$overlapping_candidates[@id = $page_overlapping_geometry/@Id]"/>
     <xsl:variable name="page_widgets_elements" select="&#10;        $hmi_elements[not(@id=$page/@id)&#10;                      and descendant-or-self::svg:*/@id = $page_overlapping_elements/@id]&#10;        /descendant-or-self::svg:*"/>
     <xsl:variable name="page_sub_elements" select="func:refered_elements($page | $page_overlapping_elements | $page_widgets_elements)"/>
     <func:result select="$page_sub_elements"/>