Merge svghmi
authorEdouard Tisserant
Fri, 24 Apr 2020 10:03:40 +0200
branchsvghmi
changeset 2946 76ebf973c47e
parent 2945 69f395c01c09 (diff)
parent 2944 2a20038fbea9 (current diff)
child 2947 25f593573579
child 2956 6b01738308bb
Merge
--- a/svghmi/svghmi.py	Wed Apr 22 15:33:53 2020 +0200
+++ b/svghmi/svghmi.py	Fri Apr 24 10:03:40 2020 +0200
@@ -78,10 +78,15 @@
                         in_common +=1
                     else:
                         break
-                if in_common > known_best_match:
+                # Match can only be HMI_NODE, and the whole path of node
+                # must match candidate node (except for name part)
+                # since candidate would become child of that node
+                if in_common > known_best_match and \
+                   child.nodetype == "HMI_NODE" and \
+                   in_common == len(child.path) - 1:
                     known_best_match = in_common
                     best_child = child
-        if best_child is not None and best_child.nodetype == "HMI_NODE":
+        if best_child is not None:
             best_child.place_node(node)
         else:
             self.children.append(node)