fix cloning element.points (#744)
This commit is contained in:
parent
b64fe9aae4
commit
6dd3620dd6
@ -65,8 +65,13 @@ export function newTextElement(
|
|||||||
export function duplicateElement(element: ReturnType<typeof newElement>) {
|
export function duplicateElement(element: ReturnType<typeof newElement>) {
|
||||||
const copy = {
|
const copy = {
|
||||||
...element,
|
...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;
|
delete copy.shape;
|
||||||
copy.id = nanoid();
|
copy.id = nanoid();
|
||||||
copy.seed = randomSeed();
|
copy.seed = randomSeed();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user