Move linear element handling out of App.tsx

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs 2025-04-08 13:44:54 +02:00
parent c2b78346c1
commit 3068787ac4
No known key found for this signature in database
4 changed files with 532 additions and 420 deletions

View file

@ -6,7 +6,6 @@ import {
invariant,
isDevEnv,
isTestEnv,
toLocalPoint,
} from "@excalidraw/common";
import {
@ -527,14 +526,18 @@ export const bindLinearElement = (
const points = Array.from(linearElement.points);
if (isArrowElement(linearElement)) {
points[edgePointIndex] = toLocalPoint(
bindPointToSnapToElementOutline(
linearElement,
hoveredElement,
startOrEnd,
elementsMap,
),
const [x, y] = bindPointToSnapToElementOutline(
linearElement,
hoveredElement,
startOrEnd,
elementsMap,
);
points[edgePointIndex] = LinearElementEditor.createPointAt(
linearElement,
elementsMap,
x,
y,
null,
);
}