fix(smoothstep): repair left/right right/left connections
This commit is contained in:
@@ -55,6 +55,18 @@ export function getSmoothStepPath({
|
|||||||
let firstCornerPath = null;
|
let firstCornerPath = null;
|
||||||
let secondCornerPath = 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 (leftAndRight.includes(sourcePosition) && leftAndRight.includes(targetPosition)) {
|
||||||
if (sourceX <= targetX) {
|
if (sourceX <= targetX) {
|
||||||
firstCornerPath =
|
firstCornerPath =
|
||||||
@@ -88,18 +100,6 @@ export function getSmoothStepPath({
|
|||||||
: topRightCorner(sourceX, targetY, cornerSize);
|
: topRightCorner(sourceX, targetY, cornerSize);
|
||||||
}
|
}
|
||||||
secondCornerPath = '';
|
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}`;
|
return `M ${sourceX},${sourceY}${firstCornerPath}${secondCornerPath}L ${targetX},${targetY}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user