1
0
mirror of https://github.com/excalidraw/excalidraw.git synced 2024-11-10 11:35:52 +01:00

fix cloning element.points (#744)

This commit is contained in:
David Luzar 2020-02-09 23:57:14 +01:00 committed by GitHub
parent b64fe9aae4
commit 6dd3620dd6

@ -65,8 +65,13 @@ export function newTextElement(
export function duplicateElement(element: ReturnType<typeof newElement>) {
const copy = {
...element,
points: JSON.parse(JSON.stringify(element.points)),
};
if ("points" in copy) {
copy.points = Array.isArray(element.points)
? JSON.parse(JSON.stringify(element.points))
: element.points;
}
delete copy.shape;
copy.id = nanoid();
copy.seed = randomSeed();