fix: Skip frame cutout for hover, but keep shape for binding

This commit is contained in:
Mark Tolmacs
2025-10-27 11:47:56 +01:00
parent 7689f71fb4
commit 6b1a9fca96

View File

@@ -555,65 +555,6 @@ export const getBindingStrategyForDraggingBindingElementEndpoints = (
return { start, end };
}
// Handle binding to shapes where the frame cuts out a part of the shape
{
const globalPoint = LinearElementEditor.getPointGlobalCoordinates(
arrow,
draggingPoints.get(startDragged ? startIdx : endIdx)!.point,
elementsMap,
);
const hoveredElement = getHoveredElementForBinding(
globalPoint,
elements,
elementsMap,
);
const intersectionPoint =
hoveredElement &&
hoveredElement.frameId &&
bindPointToSnapToElementOutline(
arrow,
hoveredElement,
startDragged ? "start" : "end",
elementsMap,
undefined,
true,
);
if (intersectionPoint) {
const enclosingFrame = elementsMap.get(hoveredElement.frameId);
if (enclosingFrame && isFrameLikeElement(enclosingFrame)) {
const enclosingFrameBounds = getElementBounds(
enclosingFrame,
elementsMap,
);
if (!pointInsideBounds(intersectionPoint, enclosingFrameBounds)) {
if (isElbowArrow(arrow)) {
return {
start: { mode: startDragged ? null : start.mode },
end: { mode: endDragged ? null : end.mode },
};
}
return {
start: startDragged
? {
mode: globalBindMode === "orbit" ? "orbit" : "inside",
element: enclosingFrame,
focusPoint: globalPoint,
}
: start,
end: endDragged
? {
mode: globalBindMode === "orbit" ? "orbit" : "inside",
element: enclosingFrame,
focusPoint: globalPoint,
}
: end,
};
}
}
}
}
// Handle simpler elbow arrow binding
if (isElbowArrow(arrow)) {
return bindingStrategyForElbowArrowEndpointDragging(
@@ -1082,21 +1023,6 @@ export const bindPointToSnapToElementOutline = (
return edgePoint;
}
// Frames can cut out bindables, so ignore the intersection if
// it isn't in the frame
if (!ignoreFrameCutouts && bindableElement.frameId) {
const enclosingFrame = elementsMap.get(bindableElement.frameId);
if (enclosingFrame && isFrameLikeElement(enclosingFrame)) {
const enclosingFrameBounds = getElementBounds(
enclosingFrame,
elementsMap,
);
if (!pointInsideBounds(intersection, enclosingFrameBounds)) {
return edgePoint;
}
}
}
return intersection;
};