From 5a350a17c0bc86a0d609f6e1acb7c80e1897ac72 Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Mon, 15 Sep 2025 10:55:00 +0200 Subject: [PATCH] fix:Add intersection padding --- packages/element/src/binding.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/element/src/binding.ts b/packages/element/src/binding.ts index 8ad101d8a..13a77a1af 100644 --- a/packages/element/src/binding.ts +++ b/packages/element/src/binding.ts @@ -1273,10 +1273,18 @@ export const updateBoundPoint = ( compareElementArea(bindableElement, otherBindableElement) < // if both shapes the same size, pretend the other is larger (startOrEnd === "endBinding" ? 1 : 0); - - const isIntersecting = otherBounds && doBoundsIntersect(bounds, otherBounds); - // const isNested = - // otherBindableElement && isBindableElementInsideOtherBindable(otherBindableElement, bindableElement); + const boundsPadding = 30; // Effectively the "minimum arrow size" in this case + const isIntersecting = + otherBounds && + doBoundsIntersect( + [ + bounds[0] - boundsPadding, + bounds[1] - boundsPadding, + bounds[2] + boundsPadding, + bounds[3] + boundsPadding, + ], + otherBounds, + ); const isNested = isIntersecting && isLargerThanOther; const maybeOutlineGlobal =