fix: Lost focus point on transition to inside-inside

This commit is contained in:
Mark Tolmacs
2026-03-26 17:07:58 +00:00
parent c1082923ee
commit 84f087633e
2 changed files with 17 additions and 11 deletions
@@ -244,7 +244,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": [ "boundElements": [
{ {
"id": "id50", "id": "id6",
"type": "arrow", "type": "arrow",
}, },
], ],
@@ -290,7 +290,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": [ "boundElements": [
{ {
"id": "id50", "id": "id6",
"type": "arrow", "type": "arrow",
}, },
], ],
@@ -335,7 +335,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": [ "boundElements": [
{ {
"id": "id51", "id": "id7",
"type": "text", "type": "text",
}, },
], ],
@@ -401,7 +401,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"autoResize": true, "autoResize": true,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"containerId": "id50", "containerId": "id6",
"customData": undefined, "customData": undefined,
"fillStyle": "solid", "fillStyle": "solid",
"fontFamily": 5, "fontFamily": 5,
@@ -1316,7 +1316,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": [ "boundElements": [
{ {
"id": "id56", "id": "id11",
"type": "text", "type": "text",
}, },
{ {
@@ -1359,7 +1359,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": [ "boundElements": [
{ {
"id": "id57", "id": "id12",
"type": "text", "type": "text",
}, },
], ],
@@ -1398,7 +1398,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": [ "boundElements": [
{ {
"id": "id58", "id": "id13",
"type": "text", "type": "text",
}, },
{ {
@@ -1441,7 +1441,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": [ "boundElements": [
{ {
"id": "id59", "id": "id14",
"type": "text", "type": "text",
}, },
{ {
@@ -1488,7 +1488,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": [ "boundElements": [
{ {
"id": "id60", "id": "id15",
"type": "text", "type": "text",
}, },
], ],
@@ -1556,7 +1556,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": [ "boundElements": [
{ {
"id": "id61", "id": "id16",
"type": "text", "type": "text",
}, },
], ],
+7 -1
View File
@@ -832,9 +832,15 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
threshold: maxBindingDistance_simple(appState.zoom), threshold: maxBindingDistance_simple(appState.zoom),
overrideShouldTestInside: true, overrideShouldTestInside: true,
}); });
const otherPointWasInsideAtStart =
!appState.selectedLinearElement?.initialState.altFocusPoint ||
pointsEqual(
appState.selectedLinearElement.initialState.altFocusPoint,
otherEndpoint,
);
const otherNeverOverride = opts?.newArrow const otherNeverOverride = opts?.newArrow
? appState.selectedLinearElement?.initialState.arrowStartIsInside ? appState.selectedLinearElement?.initialState.arrowStartIsInside
: otherBinding?.mode === "inside"; : otherBinding?.mode === "inside" && otherPointWasInsideAtStart;
const other: BindingStrategy = !otherNeverOverride const other: BindingStrategy = !otherNeverOverride
? otherBindableElement && ? otherBindableElement &&
!otherFocusPointIsInElement && !otherFocusPointIsInElement &&