From 80df9baee45c593591520fadc9290bb4d33e6b09 Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Thu, 30 Jan 2025 20:44:20 +0100 Subject: [PATCH] Fix binding suggestion Signed-off-by: Mark Tolmacs --- packages/excalidraw/components/App.tsx | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsx index f16f88657..06c472e6d 100644 --- a/packages/excalidraw/components/App.tsx +++ b/packages/excalidraw/components/App.tsx @@ -133,6 +133,7 @@ import { shouldEnableBindingForPointerEvent, updateBoundElements, getSuggestedBindingsForArrows, + getHoveredElementsForBinding, } from "../element/binding"; import { LinearElementEditor } from "../element/linearElementEditor"; import { mutateElement, newElementWith } from "../element/mutateElement"; @@ -10038,13 +10039,21 @@ class App extends React.Component { const suggestedBindings = pointerCoords.reduce( (acc: NonDeleted[], coords) => { - const hoveredBindableElement = getHoveredElementForBinding( - coords, - this.scene.getNonDeletedElements(), - this.scene.getNonDeletedElementsMap(), - this.state.zoom, - isArrowElement(linearElement) && isElbowArrow(linearElement), - ); + const hoveredBindableElement = isElbowArrow(linearElement) + ? getHoveredElementsForBinding( + coords, + this.scene.getNonDeletedElements(), + this.scene.getNonDeletedElementsMap(), + this.state.zoom, + true, + ) + : getHoveredElementForBinding( + coords, + this.scene.getNonDeletedElements(), + this.scene.getNonDeletedElementsMap(), + this.state.zoom, + isArrowElement(linearElement), + ); if ( hoveredBindableElement != null && !isLinearElementSimpleAndAlreadyBound(