fix(line-snap): prefer bindable targets over external snaps

This commit is contained in:
Ryan Di
2026-04-28 21:16:32 +10:00
parent 8763bebb59
commit 8424d78254
3 changed files with 145 additions and 12 deletions
+15 -12
View File
@@ -804,6 +804,7 @@ export const snapLinearElementPoint = (
event: KeyboardModifiersObject,
elementsMap: ElementsMap,
options: {
includeExternalPoints?: boolean;
includeSelfPoints?: boolean;
selectedPointsIndices?: readonly number[];
} = {},
@@ -827,18 +828,20 @@ export const snapLinearElementPoint = (
const nearestSnapsX: Snaps = [];
const nearestSnapsY: Snaps = [];
collectNearestAxisSnapCandidates(
getExternalAxisSnapTargets(
elements,
editingElement,
app.state,
elementsMap,
),
pointerPosition,
nearestSnapsX,
nearestSnapsY,
minOffset,
);
if (options.includeExternalPoints !== false) {
collectNearestAxisSnapCandidates(
getExternalAxisSnapTargets(
elements,
editingElement,
app.state,
elementsMap,
),
pointerPosition,
nearestSnapsX,
nearestSnapsY,
minOffset,
);
}
if (options.includeSelfPoints) {
collectNearestAxisSnapCandidates(