Skip to content

Commit

Permalink
fix: If the starting or ending point is the same as the intersection… (
Browse files Browse the repository at this point in the history
…#4279)

fix:  If the starting or ending point is the same as the intersection point, return

#4042
#3828
解决跳线异常问题
  • Loading branch information
Wangjing991 authored Apr 28, 2024
1 parent 3bb9bee commit 0bbff8f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/x6/src/registry/connector/jumpover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ function findLineIntersections(line: Line, crossCheckLines: Line[]) {
crossCheckLines.forEach((crossCheckLine) => {
const intersection = line.intersectsWithLine(crossCheckLine)
if (intersection) {
const { x, y } = intersection;
const { start, end } = crossCheckLine;
const startIsIntersection =
Math.round(start.x) === Math.round(x) &&
Math.round(start.y) === Math.round(y);
const endIsIntersection =
Math.round(end.x) === Math.round(x) &&
Math.round(end.y) === Math.round(y);
//If the starting or ending point is the same as the intersection point, return
if (startIsIntersection || endIsIntersection) {
return;
}
intersections.push(intersection)
}
})
Expand Down

0 comments on commit 0bbff8f

Please sign in to comment.