X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Felementclass%2FRouteGraphConnectionClass.java;h=5aa435920a3ee2c0ca5ac4e54b4eff8b825fe575;hb=3a31aa451eae6bc9fa359ada9df47a354605f4b6;hp=a9015fcfb95c9918f7ebaea362d677c1517abea8;hpb=28438fa467ae60dd63515be2df724c6ff9c299c9;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/elementclass/RouteGraphConnectionClass.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/elementclass/RouteGraphConnectionClass.java index a9015fcfb..5aa435920 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/elementclass/RouteGraphConnectionClass.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/elementclass/RouteGraphConnectionClass.java @@ -171,6 +171,10 @@ public class RouteGraphConnectionClass { @Override public boolean pickTest(IElement e, Shape s, PickPolicy policy) { + RouteGraphNode rgn = e.getHint(KEY_RG_NODE); + if (rgn == null) { + return false; + } RouteGraph rg = getRouteGraph(e); if (rg == null) return false; @@ -185,7 +189,7 @@ public class RouteGraphConnectionClass { if (e.containsHint(KEY_USE_TOLERANCE_IN_SELECTION)) tolerance = getTolerance(e); else - tolerance = (bounds.getHeight()+bounds.getHeight()) * 0.25; + tolerance = Math.max((bounds.getHeight()+bounds.getHeight()) * 0.25, rgn.getSelectionStrokeWidth() / 2); Object node = rg.pickLine(bounds.getCenterX(), bounds.getCenterY(), tolerance); return node != null; } @@ -194,11 +198,11 @@ public class RouteGraphConnectionClass { @Override public Rectangle2D getBounds(IElement e, Rectangle2D size) { - RouteGraph rg = getRouteGraph(e); - if (rg != null) { + RouteGraphNode rgn = e.getHint(KEY_RG_NODE); + if (rgn != null) { if (size == null) size = new Rectangle2D.Double(); - rg.getBounds(size); + size.setRect(rgn.getBoundsInLocal()); } return size; }