fix: Hovered arrow mode highlight

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs
2025-11-05 22:53:45 +01:00
parent 90e7f8cb66
commit 87d89aa090

View File

@@ -245,6 +245,8 @@ import {
mutateElement,
getElementBounds,
doBoundsIntersect,
isPointInElement,
maxBindingGap_simple,
} from "@excalidraw/element";
import type { GlobalPoint, LocalPoint, Radians } from "@excalidraw/math";
@@ -6543,6 +6545,27 @@ class App extends React.Component<AppProps, AppState> {
return;
}
if (this.state.activeTool.type === "arrow") {
const hit = getHoveredElementForBinding(
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
this.scene.getNonDeletedElements(),
this.scene.getNonDeletedElementsMap(),
(el) => maxBindingGap_simple(el, el.width, el.height, this.state.zoom),
);
if (
hit &&
!isPointInElement(
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
hit,
this.scene.getNonDeletedElementsMap(),
)
) {
this.setState({
suggestedBinding: hit,
});
}
}
const hasDeselectedButton = Boolean(event.buttons);
if (
hasDeselectedButton ||