diff --git a/packages/element/src/elbowArrow.ts b/packages/element/src/elbowArrow.ts index 95a2aa8ef..73c82a898 100644 --- a/packages/element/src/elbowArrow.ts +++ b/packages/element/src/elbowArrow.ts @@ -974,6 +974,25 @@ export const updateElbowArrowPoints = ( ), "Elbow arrow segments must be either horizontal or vertical", ); + + invariant( + updates.fixedSegments?.find( + (segment) => + segment.index === 1 && + pointsEqual(segment.start, (updates.points ?? arrow.points)[0]), + ) == null && + updates.fixedSegments?.find( + (segment) => + segment.index === (updates.points ?? arrow.points).length - 1 && + pointsEqual( + segment.end, + (updates.points ?? arrow.points)[ + (updates.points ?? arrow.points).length - 1 + ], + ), + ) == null, + "The first and last segments cannot be fixed", + ); } const fixedSegments = updates.fixedSegments ?? arrow.fixedSegments ?? []; diff --git a/packages/excalidraw/components/ConvertElementTypePopup.tsx b/packages/excalidraw/components/ConvertElementTypePopup.tsx index b1dd11cb4..8e527d549 100644 --- a/packages/excalidraw/components/ConvertElementTypePopup.tsx +++ b/packages/excalidraw/components/ConvertElementTypePopup.tsx @@ -564,7 +564,7 @@ export const convertElementTypes = ( continue; } const fixedSegments: FixedSegment[] = []; - for (let i = 0; i < nextPoints.length - 1; i++) { + for (let i = 1; i < nextPoints.length - 2; i++) { fixedSegments.push({ start: nextPoints[i], end: nextPoints[i + 1], @@ -581,6 +581,7 @@ export const convertElementTypes = ( ); mutateElement(element, app.scene.getNonDeletedElementsMap(), { ...updates, + endArrowhead: "arrow", }); } else { // if we're converting to non-elbow linear element, check if