Fix alt+drag duplication order

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs 2025-03-19 14:58:32 +01:00
parent 0fe736cd3f
commit 0e92b1206f
No known key found for this signature in database
2 changed files with 7 additions and 1 deletions

View file

@ -8447,6 +8447,7 @@ class App extends React.Component<AppProps, AppState> {
y: origEl.y,
};
},
reverseOrder: true,
});
clonedElements.forEach((element) => {
pointerDownState.originalElements.set(element.id, element);

View file

@ -105,6 +105,7 @@ export const duplicateElements = (
};
overrides?: (element: ExcalidrawElement) => Partial<ExcalidrawElement>;
randomizeSeed?: boolean;
reverseOrder?: boolean;
},
) => {
// Ids of elements that have already been processed so we don't push them
@ -192,7 +193,11 @@ export const duplicateElements = (
return;
}
elementsWithClones.splice(index + 1, 0, ...castArray(elements));
elementsWithClones.splice(
index + (opts?.reverseOrder ? 0 : +1),
0,
...castArray(elements),
);
};
const frameIdsToDuplicate = new Set(