]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteLine.java
Take zoom level into account when picking connections
[simantics/platform.git] / bundles / org.simantics.diagram.connection / src / org / simantics / diagram / connection / RouteLine.java
index c32b0ee240ec0291a21354b365d6317f61664b97..8a73ead7aec28b406bf3acd0a5ec9786d17f61ec 100644 (file)
@@ -97,11 +97,11 @@ 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 
-                    && x2 <= points.get(points.size()-1).x
+                    && points.get(0).x <= x2 - tolerance
+                    && x2 <= points.get(points.size()-1).x + tolerance
                 : Math.abs(x2-position) <= tolerance 
-                    && points.get(0).y <= y2 
-                    && y2 <= points.get(points.size()-1).y;
+                    && points.get(0).y <= y2 - tolerance
+                    && y2 <= points.get(points.size()-1).y + tolerance;
     }
 
     public void print(PrintStream out) {