]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge "Fixed two problems in connecting picking"
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 1 Nov 2019 07:23:51 +0000 (07:23 +0000)
committerGerrit Code Review <gerrit2@simantics>
Fri, 1 Nov 2019 07:23:51 +0000 (07:23 +0000)
bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteLine.java
bundles/org.simantics.g2d/src/org/simantics/g2d/elementclass/RouteGraphConnectionClass.java

index 8a73ead7aec28b406bf3acd0a5ec9786d17f61ec..91a53d85429fa0ac5a2cb0492deb53ea8573ac10 100644 (file)
@@ -97,10 +97,10 @@ public class RouteLine implements RouteNode, Serializable {
     public boolean isNear(double x2, double y2, double tolerance) {
         return isHorizontal 
                 ? Math.abs(y2-position) <= tolerance 
-                    && points.get(0).x <= x2 - tolerance
+                    && points.get(0).x - tolerance <= x2
                     && x2 <= points.get(points.size()-1).x + tolerance
                 : Math.abs(x2-position) <= tolerance 
-                    && points.get(0).y <= y2 - tolerance
+                    && points.get(0).y - tolerance <= y2
                     && y2 <= points.get(points.size()-1).y + tolerance;
     }
 
index bf4577b51e1666378a10b3b6a46e4412b54dab99..5aa435920a3ee2c0ca5ac4e54b4eff8b825fe575 100644 (file)
@@ -198,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;
         }