Do not snap linear elements

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs 2025-04-04 19:05:13 +02:00
parent 06b3750a2f
commit 6b9fa5bcc5
4 changed files with 85 additions and 63 deletions

View file

@ -525,15 +525,18 @@ export const bindLinearElement = (
};
}
const points = Array.from(linearElement.points);
points[edgePointIndex] = toLocalPoint(
bindPointToSnapToElementOutline(
if (isArrowElement(linearElement)) {
points[edgePointIndex] = toLocalPoint(
bindPointToSnapToElementOutline(
linearElement,
hoveredElement,
startOrEnd,
elementsMap,
),
linearElement,
hoveredElement,
startOrEnd,
elementsMap,
),
linearElement,
);
);
}
mutateElement(linearElement, {
points,

View file

@ -57,6 +57,7 @@ import { headingIsHorizontal, vectorToHeading } from "./heading";
import { bumpVersion, mutateElement } from "./mutateElement";
import { getBoundTextElement, handleBindTextResize } from "./textElement";
import {
isArrowElement,
isBindingElement,
isElbowArrow,
isFixedPointBinding,
@ -371,14 +372,17 @@ export class LinearElementEditor {
app.scene,
app.state.zoom,
);
newPointPosition = LinearElementEditor.createPointAt(
element,
elementsMap,
avoidancePoint[0] === newGlobalPointPosition[0]
!isArrowElement(element) ||
avoidancePoint[0] === newGlobalPointPosition[0]
? newGlobalPointPosition[0] -
linearElementEditor.pointerOffset.x
: avoidancePoint[0],
avoidancePoint[1] === newGlobalPointPosition[1]
!isArrowElement(element) ||
avoidancePoint[1] === newGlobalPointPosition[1]
? newGlobalPointPosition[1] -
linearElementEditor.pointerOffset.y
: avoidancePoint[1],