mirror of
https://github.com/excalidraw/excalidraw.git
synced 2024-11-10 11:35:52 +01:00
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>) {
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user