|
@@ -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();
|