assume toPosition is opposite to fromPosition

This commit is contained in:
Ze-Zheng Wu
2022-03-18 19:00:03 +08:00
parent 0ff63803b6
commit c1a29beb1d
2 changed files with 4 additions and 14 deletions
+2 -8
View File
@@ -82,8 +82,6 @@ export default ({
targetY: number,
targetPosition: Position | undefined;
let toCurvature: 'sourceCurvature' | 'targetCurvature';
switch (connectionHandleType) {
case 'source':
{
@@ -93,7 +91,6 @@ export default ({
targetX = toX;
targetY = toY;
targetPosition = toPosition;
toCurvature = 'targetCurvature';
}
break;
case 'target':
@@ -104,7 +101,6 @@ export default ({
targetX = fromX;
targetY = fromY;
targetPosition = fromPosition;
toCurvature = 'sourceCurvature';
}
break;
}
@@ -143,10 +139,8 @@ export default ({
};
if (connectionLineType === ConnectionLineType.Bezier) {
// we don't know the destination position, so we can zero the to curvature
dAttr = getBezierPath({ ...pathParams, [toCurvature]: 0 });
// or we assume the destination position is opposite to the source position
// dAttr = getBezierPath(pathParams);
// we assume the destination position is opposite to the source position
dAttr = getBezierPath(pathParams);
} else if (connectionLineType === ConnectionLineType.Step) {
dAttr = getSmoothStepPath({
...pathParams,