ensure duplicateElement does deep copy of points (#742)

This commit is contained in:
David Luzar 2020-02-09 23:45:21 +01:00 committed by GitHub
parent 389e40900c
commit 2a472bb912
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,7 +63,10 @@ export function newTextElement(
} }
export function duplicateElement(element: ReturnType<typeof newElement>) { export function duplicateElement(element: ReturnType<typeof newElement>) {
const copy = { ...element }; const copy = {
...element,
points: JSON.parse(JSON.stringify(element.points)),
};
delete copy.shape; delete copy.shape;
copy.id = nanoid(); copy.id = nanoid();
copy.seed = randomSeed(); copy.seed = randomSeed();