From 2a472bb91242c5fe5f785705819cc5e89138d19b Mon Sep 17 00:00:00 2001 From: David Luzar Date: Sun, 9 Feb 2020 23:45:21 +0100 Subject: [PATCH] ensure duplicateElement does deep copy of points (#742) --- src/element/newElement.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/element/newElement.ts b/src/element/newElement.ts index 812afb4c..314493f2 100644 --- a/src/element/newElement.ts +++ b/src/element/newElement.ts @@ -63,7 +63,10 @@ export function newTextElement( } export function duplicateElement(element: ReturnType) { - const copy = { ...element }; + const copy = { + ...element, + points: JSON.parse(JSON.stringify(element.points)), + }; delete copy.shape; copy.id = nanoid(); copy.seed = randomSeed();