Fix grouped groups not being copy-pastable

This commit is contained in:
Skyler Lehmkuhl 2025-01-06 19:20:48 -05:00
parent 97ff909559
commit 28f17a6b6e
1 changed files with 13 additions and 3 deletions

View File

@ -2049,7 +2049,7 @@ class Frame {
} else {
json.idx = this.idx;
}
json.keys = this.keys;
json.keys = structuredClone(this.keys);
json.shapes = [];
for (let shape of this.shapes) {
json.shapes.push(shape.toJSON(randomizeUuid));
@ -2146,13 +2146,23 @@ class Layer {
json.name = this.name;
}
json.children = [];
let idMap = {}
for (let child of this.children) {
json.children.push(child.toJSON(randomizeUuid));
let childJson = child.toJSON(randomizeUuid)
idMap[child.idx] = childJson.idx
json.children.push(childJson);
}
json.frames = [];
for (let frame of this.frames) {
if (frame) {
json.frames.push(frame.toJSON(randomizeUuid));
let frameJson = frame.toJSON(randomizeUuid)
for (let key in frameJson.keys) {
if (key in idMap) {
frameJson.keys[idMap[key]] = frameJson.keys[key]
delete frameJson.keys[key]
}
}
json.frames.push(frameJson);
} else {
json.frames.push(undefined)
}