Browse Source

fix: Elbow arrow routing issue with diamonds and ellipses (#10021)

pull/9209/head
Márk Tolmács 3 months ago committed by GitHub
parent
commit
06c40006db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      packages/element/src/binding.ts

23
packages/element/src/binding.ts

@ -999,6 +999,29 @@ export const bindPointToSnapToElementOutline = ( @@ -999,6 +999,29 @@ export const bindPointToSnapToElementOutline = (
intersector,
FIXED_BINDING_DISTANCE,
).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 {
intersection = intersectElementWithLineSegment(
bindableElement,

Loading…
Cancel
Save