0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 05:33:02 -05:00

Fix masks in components (#129)

* fix masks in components

* fixes

* fixes
This commit is contained in:
Alex Sánchez 2024-06-03 09:38:44 +02:00 committed by GitHub
parent f8e6b6ecd9
commit 92167aca42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
"penpot-exporter": patch
---
Fix masks not working in components

View file

@ -9,6 +9,16 @@ export const transformFigmaIds = (
};
};
export const transformMaskFigmaIds = (
node: SceneNode
): Pick<ShapeBaseAttributes, 'figmaId' | 'figmaRelatedId'> => {
const transformedIds = transformFigmaIds(node);
return {
figmaId: `M${transformedIds.figmaId}`,
figmaRelatedId: transformedIds.figmaRelatedId ? `M${transformedIds.figmaRelatedId}` : undefined
};
};
const getRelatedNodeId = (nodeId: string): string | undefined => {
const ids = nodeId.split(';');

View file

@ -1,4 +1,5 @@
import { transformGroupNodeLike, transformSceneNode } from '@plugin/transformers';
import { transformMaskFigmaIds } from '@plugin/transformers/partials';
import { sleep } from '@plugin/utils';
import { PenpotNode } from '@ui/types';
@ -23,6 +24,7 @@ export const translateMaskChildren = async (
const maskedChildren = await translateChildren(children.slice(maskIndex), baseX, baseY);
const maskGroup = {
...transformMaskFigmaIds(maskChild),
...transformGroupNodeLike(maskChild, baseX, baseY),
children: maskedChildren,
maskedGroup: true