Skip to content

Commit

Permalink
fix: error when diamondNode's edge is dragging
Browse files Browse the repository at this point in the history
  • Loading branch information
liuziqi authored and boyongjiong committed Apr 19, 2024
1 parent 74db19a commit 4978bf1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/core/src/model/edge/PolylineEdgeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ export default class PolylineEdgeModel extends BaseEdgeModel {
default:
break;
}
list[0] = startCrossPoint;
// 如果线段和形状没有交点时startCrossPoint会为undefined导致后续计算报错
if (startCrossPoint) {
list[0] = startCrossPoint;
}
const endPointDirection = segmentDirection(pre, end);
let endCrossPoint = list[list.length - 1];
switch (targetModelType) {
Expand All @@ -236,7 +239,10 @@ export default class PolylineEdgeModel extends BaseEdgeModel {
default:
break;
}
list[list.length - 1] = endCrossPoint;
// 如果线段和形状没有交点时startCrossPoint会为undefined导致后续计算报错
if (endCrossPoint) {
list[list.length - 1] = endCrossPoint;
}
return list;
}

Expand Down
Binary file added site/mvp/src/components/node/image/circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4978bf1

Please sign in to comment.