]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Potential fix for diagram scene graph screw-up regression 91/1291/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 5 Dec 2017 20:32:59 +0000 (22:32 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 5 Dec 2017 20:32:59 +0000 (22:32 +0200)
refs #7663

Change-Id: I092889d83fcfd653647e4de38984304461649b3f

bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/CompositeImage.java

index b8a5daa2681f7b739fcf42efc9414f918b32f761..d4e20230185f18ae59c94824132ed88b401a772f 100644 (file)
@@ -155,8 +155,11 @@ public class CompositeImage implements Image {
     private G2DParentNode getOrCreateParentNode(G2DParentNode parent) {
         G2DParentNode node = (G2DParentNode)parent.getNode("composite_image_"+this.hashCode());
         if (node == null) {
-            for (INode n : parent.getNodes())
-                n.remove();
+            for (INode n : parent.getNodes()) {
+                // #7663: prevent the code from removing other element graphics from directly under another element
+                if (!(n instanceof SingleElementNode))
+                    n.remove();
+            }
             // Removed this grouping node as unnecessary, just use the given parent node
             node = parent.getOrCreateNode("composite_image_"+this.hashCode(), G2DParentNode.class);
         }