Explorar el Código

ensure duplicateElement does deep copy of points (#742)

David Luzar hace 5 años
padre
commit
2a472bb912
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      src/element/newElement.ts

+ 4 - 1
src/element/newElement.ts

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