diff --git a/packages/sprotty/src/features/edge-intersection/intersection-finder.ts b/packages/sprotty/src/features/edge-intersection/intersection-finder.ts index c1e0a307..ece77f5a 100644 --- a/packages/sprotty/src/features/edge-intersection/intersection-finder.ts +++ b/packages/sprotty/src/features/edge-intersection/intersection-finder.ts @@ -89,10 +89,24 @@ export class IntersectionFinder implements IEdgeRoutePostprocessor { */ find(routing: EdgeRouting): Intersection[] { const eventQueue = new TinyQueue(undefined, checkWhichEventIsLeft); - routing.routes.forEach((route, routeId) => addRoute(routeId, route, eventQueue)); + routing.routes.forEach((route, routeId) => { + if (this.isSupportedRoute(route)) { + addRoute(routeId, route, eventQueue); + } + }); return runSweep(eventQueue); } + /** + * Specifies whether or not a specific route should be included in this intersection search or not. + * + * As this intersection finder only supports linear line segments, this method only returns `true` + * for routes that only contain routed points, which are either 'source', 'target' or 'linear'. + */ + protected isSupportedRoute(route: RoutedPoint[]): boolean { + return route.find(point => point.kind !== 'source' && point.kind !== 'target' && point.kind !== 'linear') === undefined; + } + protected addToRouting(intersections: Intersection[], routing: EdgeRouting) { for (const intersection of intersections) { const routable1 = routing.get(intersection.routable1); diff --git a/packages/sprotty/src/graph/views.tsx b/packages/sprotty/src/graph/views.tsx index 28157a7e..fb985565 100644 --- a/packages/sprotty/src/graph/views.tsx +++ b/packages/sprotty/src/graph/views.tsx @@ -274,8 +274,12 @@ export class PolylineEdgeViewWithGapsOnIntersections extends JumpingPolylineEdge protected skipOffsetBefore = 3; protected skipOffsetAfter = 3; - protected createJumpPath(intersectionPoint: Point, lineSegment: PointToPointLine): string { - return ""; + protected shouldDrawLineJumpOnIntersection(currentLineSegment: PointToPointLine, otherLineSegment: PointToPointLine) { + return false; + } + + protected shouldDrawLineGapOnIntersection(currentLineSegment: PointToPointLine, otherLineSegment: PointToPointLine) { + return Math.abs(currentLineSegment.slopeOrMax) >= Math.abs(otherLineSegment.slopeOrMax); } protected createGapPath(intersectionPoint: Point, lineSegment: PointToPointLine): string {