No center focus point

This commit is contained in:
Mark Tolmacs
2025-08-11 16:44:02 +02:00
parent 27467fc8a6
commit 5364e48f79

View File

@@ -391,10 +391,7 @@ const bindingStrategyForNewSimpleArrowEndpointDragging = (
start: { start: {
mode: globalBindMode === "inside" ? "inside" : "orbit", mode: globalBindMode === "inside" ? "inside" : "orbit",
element: hovered, element: hovered,
focusPoint: focusPoint: arrowOriginalStartPoint ?? center,
globalBindMode === "inside"
? arrowOriginalStartPoint ?? center
: center,
}, },
end: { mode: null }, end: { mode: null },
}; };
@@ -405,21 +402,19 @@ const bindingStrategyForNewSimpleArrowEndpointDragging = (
const otherElement = elementsMap.get(arrow.startBinding.elementId); const otherElement = elementsMap.get(arrow.startBinding.elementId);
invariant(otherElement, "Other element must be in the elements map"); invariant(otherElement, "Other element must be in the elements map");
const center = pointFrom<GlobalPoint>(
otherElement.x + otherElement.width / 2,
otherElement.y + otherElement.height / 2,
);
const otherIsInsideBinding = const otherIsInsideBinding =
!!appState.selectedLinearElement?.pointerDownState.arrowStartIsInside; !!appState.selectedLinearElement?.pointerDownState.arrowStartIsInside;
// We need to "jump" the start point out with the detached // We need to "jump" the start point out with the detached
// focus point of the center of the bound element // focus point of the center of the bound element
invariant(
arrowOriginalStartPoint,
"Arrow original start point must be defined",
);
const other: BindingStrategy = { const other: BindingStrategy = {
mode: otherIsInsideBinding ? "inside" : "orbit", mode: otherIsInsideBinding ? "inside" : "orbit",
element: otherElement as ExcalidrawBindableElement, element: otherElement as ExcalidrawBindableElement,
focusPoint: otherIsInsideBinding focusPoint: arrowOriginalStartPoint,
? arrowOriginalStartPoint ?? center
: center,
}; };
let current: BindingStrategy; let current: BindingStrategy;
@@ -429,12 +424,7 @@ const bindingStrategyForNewSimpleArrowEndpointDragging = (
current = { current = {
mode: isInsideBinding ? "inside" : "orbit", mode: isInsideBinding ? "inside" : "orbit",
element: hovered, element: hovered,
focusPoint: isInsideBinding focusPoint: point,
? point
: pointFrom<GlobalPoint>(
hovered.x + hovered.width / 2,
hovered.y + hovered.height / 2,
),
}; };
} else { } else {
current = { mode: null }; current = { mode: null };