From 90e7f8cb66bbcd636beb1305a7b015320766b27b Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Wed, 5 Nov 2025 22:28:32 +0100 Subject: [PATCH] feat: Jump other binding Signed-off-by: Mark Tolmacs --- packages/element/src/binding.ts | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/packages/element/src/binding.ts b/packages/element/src/binding.ts index 292f118b74..bf36ba09ee 100644 --- a/packages/element/src/binding.ts +++ b/packages/element/src/binding.ts @@ -697,10 +697,37 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = ( ) || globalPoint, } : { mode: null }; + const otherBindableElement = otherBinding + ? (elementsMap.get( + otherBinding.elementId, + ) as NonDeleted) + : undefined; + const otherPoint = LinearElementEditor.getPointAtIndexGlobalCoordinates( + arrow, + startDragged ? -1 : 0, + elementsMap, + ); + const other: BindingStrategy = + opts?.newArrow && + otherBindableElement && + !isPointInElement(otherPoint, otherBindableElement, elementsMap) + ? { + mode: "orbit", + element: otherBindableElement, + focusPoint: + projectFixedPointOntoDiagonal( + arrow, + otherPoint, + otherBindableElement, + startDragged ? "end" : "start", + elementsMap, + ) || otherPoint, + } + : { mode: undefined }; return { - start: startDragged ? current : start, - end: endDragged ? current : end, + start: startDragged ? current : other, + end: endDragged ? current : other, }; };