Fix freshly created elbow arrow and bindable interaction

This commit is contained in:
Mark Tolmacs 2025-03-02 15:51:07 +01:00
parent fe58962bfd
commit 2af0336466
2 changed files with 9 additions and 4 deletions

View file

@ -1249,6 +1249,7 @@ const getElbowArrowData = (
...arrow,
type: "arrow",
elbowed: true,
type: "arrow",
points: nextPoints,
} as ExcalidrawElbowArrowElement,
"start",
@ -1262,6 +1263,7 @@ const getElbowArrowData = (
...arrow,
type: "arrow",
elbowed: true,
type: "arrow",
points: nextPoints,
} as ExcalidrawElbowArrowElement,
"end",

View file

@ -263,8 +263,10 @@ export class LinearElementEditor {
return null;
}
const elbowed = isElbowArrow(element);
if (
isElbowArrow(element) &&
elbowed &&
!linearElementEditor.pointerDownState.lastClickedIsEndPoint &&
linearElementEditor.pointerDownState.lastClickedPoint !== 0
) {
@ -281,7 +283,7 @@ export class LinearElementEditor {
: undefined,
].filter((idx): idx is number => idx !== undefined)
: linearElementEditor.selectedPointsIndices;
const lastClickedPoint = isElbowArrow(element)
const lastClickedPoint = elbowed
? linearElementEditor.pointerDownState.lastClickedPoint > 0
? element.points.length - 1
: 0
@ -337,6 +339,7 @@ export class LinearElementEditor {
element.x + element.points[pointIndex][0] + deltaX,
element.y + element.points[pointIndex][1] + deltaY,
);
if (
pointIndex === lastClickedPoint &&
(pointIndex === 0 || pointIndex === element.points.length - 1)
@ -349,8 +352,8 @@ export class LinearElementEditor {
app.scene.getNonDeletedElements(),
app.scene.getNonDeletedElementsMap(),
app.state.zoom,
isElbowArrow(element),
isElbowArrow(element),
elbowed,
elbowed,
);
if (hoveredElement) {
const newPoints = Array.from(element.points);