From 1650e6ac82cd1a9c2a1ced437954b1a0e7c373b9 Mon Sep 17 00:00:00 2001 From: moklick Date: Thu, 26 Nov 2020 16:58:15 +0100 Subject: [PATCH] fix(smoothstep): repair left/right right/left connections --- src/components/Edges/SmoothStepEdge.tsx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/Edges/SmoothStepEdge.tsx b/src/components/Edges/SmoothStepEdge.tsx index eaf1b0f7..3b6b5e5c 100644 --- a/src/components/Edges/SmoothStepEdge.tsx +++ b/src/components/Edges/SmoothStepEdge.tsx @@ -55,6 +55,18 @@ export function getSmoothStepPath({ let firstCornerPath = null; let secondCornerPath = null; + if (sourceX <= targetX) { + firstCornerPath = + sourceY <= targetY ? bottomLeftCorner(sourceX, cY, cornerSize) : topLeftCorner(sourceX, cY, cornerSize); + secondCornerPath = + sourceY <= targetY ? rightTopCorner(targetX, cY, cornerSize) : rightBottomCorner(targetX, cY, cornerSize); + } else { + firstCornerPath = + sourceY < targetY ? bottomRightCorner(sourceX, cY, cornerSize) : topRightCorner(sourceX, cY, cornerSize); + secondCornerPath = + sourceY < targetY ? leftTopCorner(targetX, cY, cornerSize) : leftBottomCorner(targetX, cY, cornerSize); + } + if (leftAndRight.includes(sourcePosition) && leftAndRight.includes(targetPosition)) { if (sourceX <= targetX) { firstCornerPath = @@ -88,18 +100,6 @@ export function getSmoothStepPath({ : topRightCorner(sourceX, targetY, cornerSize); } secondCornerPath = ''; - } else { - if (sourceX <= targetX) { - firstCornerPath = - sourceY <= targetY ? bottomLeftCorner(sourceX, cY, cornerSize) : topLeftCorner(sourceX, cY, cornerSize); - secondCornerPath = - sourceY <= targetY ? rightTopCorner(targetX, cY, cornerSize) : rightBottomCorner(targetX, cY, cornerSize); - } else { - firstCornerPath = - sourceY < targetY ? bottomRightCorner(sourceX, cY, cornerSize) : topRightCorner(sourceX, cY, cornerSize); - secondCornerPath = - sourceY < targetY ? leftTopCorner(targetX, cY, cornerSize) : leftBottomCorner(targetX, cY, cornerSize); - } } return `M ${sourceX},${sourceY}${firstCornerPath}${secondCornerPath}L ${targetX},${targetY}`;