Different approach to inside binding

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs 2025-08-02 08:24:56 +02:00
parent c229e7a42a
commit ac5612db2a
No known key found for this signature in database
2 changed files with 11 additions and 1 deletions

View File

@ -409,7 +409,8 @@ const bindingStrategyForNewSimpleArrowEndpointDragging = (
otherElement.x + otherElement.width / 2, otherElement.x + otherElement.width / 2,
otherElement.y + otherElement.height / 2, otherElement.y + otherElement.height / 2,
); );
const otherIsInsideBinding = arrow.startBinding?.mode === "inside"; const otherIsInsideBinding =
!!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

View File

@ -143,6 +143,7 @@ export class LinearElementEditor {
added: boolean; added: boolean;
}; };
arrowOriginalStartPoint?: GlobalPoint; arrowOriginalStartPoint?: GlobalPoint;
arrowStartIsInside: boolean;
}>; }>;
/** whether you're dragging a point */ /** whether you're dragging a point */
@ -186,6 +187,7 @@ export class LinearElementEditor {
index: null, index: null,
added: false, added: false,
}, },
arrowStartIsInside: false,
}; };
this.hoverPointIndex = -1; this.hoverPointIndex = -1;
this.segmentMidPointHoveredCoords = null; this.segmentMidPointHoveredCoords = null;
@ -582,6 +584,7 @@ export class LinearElementEditor {
pointerDownState: { pointerDownState: {
...editingLinearElement.pointerDownState, ...editingLinearElement.pointerDownState,
arrowOriginalStartPoint: undefined, arrowOriginalStartPoint: undefined,
arrowStartIsInside: false,
}, },
}; };
} }
@ -889,6 +892,9 @@ export class LinearElementEditor {
index: segmentMidpointIndex, index: segmentMidpointIndex,
added: false, added: false,
}, },
arrowStartIsInside:
!!app.state.newElement &&
(app.state.bindMode === "inside" || app.state.bindMode === "skip"),
}, },
selectedPointsIndices: [element.points.length - 1], selectedPointsIndices: [element.points.length - 1],
lastUncommittedPoint: null, lastUncommittedPoint: null,
@ -948,6 +954,9 @@ export class LinearElementEditor {
index: segmentMidpointIndex, index: segmentMidpointIndex,
added: false, added: false,
}, },
arrowStartIsInside:
!!app.state.newElement &&
(app.state.bindMode === "inside" || app.state.bindMode === "skip"),
}, },
selectedPointsIndices: nextSelectedPointsIndices, selectedPointsIndices: nextSelectedPointsIndices,
pointerOffset: targetPoint pointerOffset: targetPoint