Skip to content

Commit

Permalink
feat(routers.RightAngle): vertex in the target bbox improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinKanera committed Oct 17, 2023
1 parent 790364a commit 8127f6b
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions src/routers/rightAngle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -681,36 +681,26 @@ function routeBetweenPoints(source, target) {
if ((y < tcy || !isSourceEl) && y > tmy0 && sox > tx1) {
y = tmy1;
}

return [
{ x: sox, y },
{ x: tox, y },
{ x: tox, y: toy }
];
}
return [{ x: sox, y: toy }];
} else {
if (sx1 > tox) {
const y = Math.max(smy1, tmy1);
const x = Math.min(smx0, tmx0);
return [
{ x: sox, y },
{ x, y },
{ x, y: toy }
];
}
}

const x = Math.min(tmx0, middleOfVerticalSides);

if (sox < tox && sy0 <= toy) {
return [
{ x: sox, y: soy },
{ x, y: soy },
{ x, y: toy }
];
}

if (x < smx1 && soy > ty0) {
const y = Math.max(smy1, tmy1);
const x = Math.min(smx0, tmx0);

return [
{ x: sox, y },
{ x, y },
{ x, y: toy }
];
}
const x = middleOfVerticalSides;

return [
{ x: sox, y: soy },
Expand Down

0 comments on commit 8127f6b

Please sign in to comment.