Further adjustments for edge cases

This commit is contained in:
Mark Tolmacs 2025-04-25 18:54:18 +02:00
parent c7c6a4c3f1
commit 9a2bd18904
No known key found for this signature in database
3 changed files with 40 additions and 31 deletions

View file

@ -951,7 +951,6 @@ export const bindPointToSnapToElementOutline = (
otherPoint,
),
),
0.1,
)[0];
} else {
intersection = intersectElementWithLineSegment(
@ -1116,6 +1115,17 @@ export const avoidRectangularCorner = (
);
}
// Break up explicit border bindings to have better elbow arrow routing
if (p[0] === element.x) {
return pointFrom(p[0] - FIXED_BINDING_DISTANCE, p[1]);
} else if (p[0] === element.x + element.width) {
return pointFrom(p[0] + FIXED_BINDING_DISTANCE, p[1]);
} else if (p[1] === element.y) {
return pointFrom(p[0], p[1] - FIXED_BINDING_DISTANCE);
} else if (p[1] === element.y + element.height) {
return pointFrom(p[0], p[1] + FIXED_BINDING_DISTANCE);
}
return p;
};