Skip to content

Commit

Permalink
chore: add managing layers with "shapes" property
Browse files Browse the repository at this point in the history
  • Loading branch information
sneko committed Jun 26, 2024
1 parent 9c44b61 commit aeeb5f2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion src/features/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ export function getDifferences(currentTree: PenpotDocument, newTree: PenpotDocum
parentId: isPageRootFrameFromId(item.after.parentId) ? rootFrameId : item.after.parentId,
obj: {
...propertiesObj,
shapes: item.after.type === 'frame' ? [] : undefined, // This is required to create frames (we don't have this into the comparaison trees to only go from top to bottom with a simple logic)
},
});
}
Expand Down
4 changes: 0 additions & 4 deletions src/features/penpot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ export function cleanHostedDocument(hostedTree: PostCommandGetFileResponse): Pen

// Then manage the rest of the logic
for (const [, object] of Object.entries(page.objects)) {
if (object.type === 'bool' || object.type === 'frame' || object.type === 'group') {
delete object.shapes; // Since object is a reference it will act on the main object
}

object.parentId = object.parentId === rootFrameId ? newRootFrameNodeId : object.parentId;
object.frameId = object.frameId === rootFrameId ? newRootFrameNodeId : object.frameId;
}
Expand Down
1 change: 1 addition & 0 deletions src/features/transformers/transformPageNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export function transformPageNode(figmaNode: CanvasNode, mapping: MappingType):
fillOpacity: 1,
},
],
shapes: figmaNode.children.map((figmaChild) => translateId(figmaChild.id, mapping)),
},
},
};
Expand Down

0 comments on commit aeeb5f2

Please sign in to comment.