Merge branch 'master' into mtolmacs/feat/fixed-point-simple-arrow-binding

This commit is contained in:
Mark Tolmacs
2025-09-24 19:38:23 +02:00
8 changed files with 187 additions and 79 deletions

View File

@@ -942,6 +942,29 @@ export const bindPointToSnapToElementOutline = (
intersector,
getFixedBindingDistance(bindableElement),
).sort(pointDistanceSq)[0];
if (!intersection) {
const anotherPoint = pointFrom<GlobalPoint>(
!isHorizontal ? center[0] : snapPoint[0],
isHorizontal ? center[1] : snapPoint[1],
);
const anotherIntersector = lineSegment(
anotherPoint,
pointFromVector(
vectorScale(
vectorNormalize(vectorFromPoint(snapPoint, anotherPoint)),
Math.max(bindableElement.width, bindableElement.height) * 2,
),
anotherPoint,
),
);
intersection = intersectElementWithLineSegment(
bindableElement,
elementsMap,
anotherIntersector,
FIXED_BINDING_DISTANCE,
).sort(pointDistanceSq)[0];
}
} else {
const halfVector = vectorScale(
vectorNormalize(vectorFromPoint(edgePoint, adjacentPoint)),