mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-11-03 12:25:51 +01:00
fix: Skip frame cutout for hover, but keep shape for binding
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user