X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.diagram.connection%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fconnection%2FRouteTerminal.java;fp=bundles%2Forg.simantics.diagram.connection%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fconnection%2FRouteTerminal.java;h=3d6bd182f664b9146c5686155ac8d4f541e6f8cf;hp=dd660d4aaa659df5bce98302794586549e423c04;hb=452d45fd64c45cbfadc15e8edc11c0cda4e101e0;hpb=d788b5fea66a6dffe1649de57bc83705e6027bc0 diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteTerminal.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteTerminal.java index dd660d4aa..3d6bd182f 100644 --- a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteTerminal.java +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteTerminal.java @@ -164,18 +164,31 @@ public class RouteTerminal extends RoutePoint implements RouteNode, Serializable boolean routeLineDoesNotIntersectTerminal; double linePosition = line.position; if(line.isHorizontal) { + if (linePosition == y) { + // direct route to terminal + line.addPoint(this); + return; + } lineDir = linePosition < y ? 3 : 1; routeLineDoesNotIntersectTerminal = linePosition <= minY || linePosition >= maxY || boundingBoxesIntersect /* we ignore intersection in this case */; } else { + if (linePosition == x) { + // direct route to terminal + line.addPoint(this); + return; + } lineDir = linePosition < x ? 2 : 0; routeLineDoesNotIntersectTerminal = linePosition <= minX || linePosition >= maxX || boundingBoxesIntersect /* we ignore intersection in this case */; } // We can route the connection directly to the right direction - if(routeLineDoesNotIntersectTerminal && + if((routeLineDoesNotIntersectTerminal || + (line.isHorizontal && (x == minX || x == maxX)) || // already on the top/bottom edge + (!line.isHorizontal && (y == minY || y == maxY)) // already on the left/right edge + ) && Directions.isAllowed(allowedDirections, lineDir)) { RouteLine line0 = createLine0(lineDir); new RouteLink(line0, line);