فهرست منبع

ensure duplicateElement does deep copy of points (#742)

David Luzar 5 سال پیش
والد
کامیت
2a472bb912
1فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  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();