fix: Binding hit test

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs
2026-02-05 22:10:03 +01:00
parent b2b2815954
commit 281c99e2d1
6 changed files with 128 additions and 107 deletions
+11 -4
View File
@@ -270,6 +270,7 @@ const bindingStrategyForElbowArrowEndpointDragging = (
elementsMap,
);
const hit = getHoveredElementForBinding(
arrow,
globalPoint,
elements,
elementsMap,
@@ -321,7 +322,7 @@ const bindingStrategyForNewSimpleArrowEndpointDragging = (
draggingPoints.get(startDragged ? startIdx : endIdx)!.point,
elementsMap,
);
const hit = getHoveredElementForBinding(point, elements, elementsMap);
const hit = getHoveredElementForBinding(arrow, point, elements, elementsMap);
// With new arrows this handles the binding at arrow creation
if (startDragged) {
@@ -366,7 +367,12 @@ const bindingStrategyForNewSimpleArrowEndpointDragging = (
// Check and handle nested shapes
if (hit && arrow.startBinding) {
const startBinding = arrow.startBinding;
const allHits = getAllHoveredElementAtPoint(point, elements, elementsMap);
const allHits = getAllHoveredElementAtPoint(
arrow,
point,
elements,
elementsMap,
);
if (allHits.find((el) => el.id === startBinding.elementId)) {
const otherElement = elementsMap.get(
@@ -468,9 +474,9 @@ const bindingStrategyForSimpleArrowEndpointDragging_complex = (
let other: BindingStrategy = { mode: undefined };
const isMultiPoint = arrow.points.length > 2;
const hit = getHoveredElementForBinding(point, elements, elementsMap);
const hit = getHoveredElementForBinding(arrow, point, elements, elementsMap);
const isOverlapping = oppositeBinding
? getAllHoveredElementAtPoint(point, elements, elementsMap).some(
? getAllHoveredElementAtPoint(arrow, point, elements, elementsMap).some(
(el) => el.id === oppositeBinding.elementId,
)
: false;
@@ -695,6 +701,7 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
elementsMap,
);
const hit = getHoveredElementForBinding(
arrow,
globalPoint,
elements,
elementsMap,