mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix elbow segment indexing
This commit is contained in:
parent
f99fe54797
commit
900ee41d0f
1 changed files with 5 additions and 4 deletions
|
@ -583,17 +583,18 @@ export const switchShapes = (
|
||||||
|
|
||||||
if (isElbowArrow(element)) {
|
if (isElbowArrow(element)) {
|
||||||
const nextPoints = convertLineToElbow(element);
|
const nextPoints = convertLineToElbow(element);
|
||||||
|
if (nextPoints.length < 2) {
|
||||||
|
// skip if not enough points to form valid segments
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const fixedSegments: FixedSegment[] = [];
|
const fixedSegments: FixedSegment[] = [];
|
||||||
|
|
||||||
for (let i = 0; i < nextPoints.length - 1; i++) {
|
for (let i = 0; i < nextPoints.length - 1; i++) {
|
||||||
fixedSegments.push({
|
fixedSegments.push({
|
||||||
start: nextPoints[i],
|
start: nextPoints[i],
|
||||||
end: nextPoints[i + 1],
|
end: nextPoints[i + 1],
|
||||||
index: i,
|
index: i + 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const updates = updateElbowArrowPoints(
|
const updates = updateElbowArrowPoints(
|
||||||
element,
|
element,
|
||||||
app.scene.getNonDeletedElementsMap(),
|
app.scene.getNonDeletedElementsMap(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue