From: Jussi Koskela Date: Wed, 10 Jun 2020 10:51:55 +0000 (+0300) Subject: Propagate ignoreNulls parameter recursively in bounds calculation X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F03%2F4303%2F1;p=simantics%2Fplatform.git Propagate ignoreNulls parameter recursively in bounds calculation Change-Id: Iea4cc6b2da17967944d0f67fc8da362c579d70a6 --- diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/G2DParentNode.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/G2DParentNode.java index af8c5630d..a752e9253 100644 --- a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/G2DParentNode.java +++ b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/G2DParentNode.java @@ -349,11 +349,12 @@ public class G2DParentNode extends ParentNode implements IG2DNode, Ini Rectangle2D bounds = null; while(it.hasNext()) { IG2DNode node = it.next(); - Rectangle2D b = node.getBounds(); + Rectangle2D b = node.getBoundsInLocal(ignoreNulls); if(b == null && !ignoreNulls) return null; if(b != null) { if(!GeometryUtils.isUndefinedRectangle(b)) { + b = node.localToParent(b); if(bounds == null) { bounds = b.getFrame(); } else { diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/LinkNode.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/LinkNode.java index 50d50ecd2..aa570d6aa 100644 --- a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/LinkNode.java +++ b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/LinkNode.java @@ -131,6 +131,11 @@ public class LinkNode extends StateMaskNode { @Override public Rectangle2D getBoundsInLocal() { + return getBoundsInLocal(false); + } + + @Override + public Rectangle2D getBoundsInLocal(boolean ignoreNulls) { // Safety against cyclic cases. if (hasFlags(IN_GET_BOUNDS)) return new Rectangle2D.Double(); @@ -141,7 +146,7 @@ public class LinkNode extends StateMaskNode { setFlags(IN_GET_BOUNDS); try { - Rectangle2D bounds = n.getBoundsInLocal(); + Rectangle2D bounds = n.getBoundsInLocal(ignoreNulls); if (transform != null && !transform.isIdentity()) bounds = transform.createTransformedShape(bounds).getBounds2D(); return bounds;