From 03887ad79f7404359c97db9473d4cdc1061d46af Mon Sep 17 00:00:00 2001 From: moklick Date: Mon, 1 Nov 2021 12:03:16 +0100 Subject: [PATCH] fix(edges): connect from left to right with connection mode loose closes #1613 --- src/components/Edges/SmoothStepEdge.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/Edges/SmoothStepEdge.tsx b/src/components/Edges/SmoothStepEdge.tsx index 0c42410a..d75ec875 100644 --- a/src/components/Edges/SmoothStepEdge.tsx +++ b/src/components/Edges/SmoothStepEdge.tsx @@ -52,6 +52,8 @@ export function getSmoothStepPath({ const cX = typeof centerX !== 'undefined' ? centerX : _centerX; const cY = typeof centerY !== 'undefined' ? centerY : _centerY; + console.log(sourcePosition, targetPosition); + let firstCornerPath = null; let secondCornerPath = null; @@ -73,8 +75,12 @@ export function getSmoothStepPath({ sourceY <= targetY ? rightTopCorner(cX, sourceY, cornerSize) : rightBottomCorner(cX, sourceY, cornerSize); secondCornerPath = sourceY <= targetY ? bottomLeftCorner(cX, targetY, cornerSize) : topLeftCorner(cX, targetY, cornerSize); - } else if (sourcePosition === Position.Right && targetPosition === Position.Left){ - // and sourceX > targetX + } else if ( + (sourcePosition === Position.Right && targetPosition === Position.Left) || + (sourcePosition === Position.Left && targetPosition === Position.Right) || + (sourcePosition === Position.Left && targetPosition === Position.Left) + ) { + // and sourceX > targetX firstCornerPath = sourceY <= targetY ? leftTopCorner(cX, sourceY, cornerSize) : leftBottomCorner(cX, sourceY, cornerSize); secondCornerPath =