From: Tuukka Lehtonen Date: Tue, 26 May 2020 10:33:48 +0000 (+0000) Subject: Merge "Counting of pending nodes does not work if null text is saved as """ X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=680a2159d36d893cf7fbf0212e7ffbff847a8f82;hp=6d3ac0a19489d85ee5264f860dd757b466eb7b00 Merge "Counting of pending nodes does not work if null text is saved as """ --- diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ShapePick.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ShapePick.java index a1d31acf0..3766a751b 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ShapePick.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ShapePick.java @@ -39,6 +39,8 @@ public class ShapePick implements Pick { pickRect = s.getBounds2D(); Shape es = ElementUtils.getElementShapeOrBounds(e); + // getElementShapeOrBounds returns shape or bounds in local coords! + es = ElementUtils.getTransform(e).createTransformedShape(es); PathIterator iter = es.getPathIterator(null); Collection segments = new ArrayList(); PathUtils.toLineSegments(iter, segments); @@ -55,7 +57,12 @@ public class ShapePick implements Pick { for (double[] seg : segments) { if (pickRect.intersectsLine(seg[0], seg[1], seg[2], seg[3])) return true; + if (pickRect.contains(seg[0], seg[1])) + return true; + if (pickRect.contains(seg[2], seg[3])) + return true; } + return false; }