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:
parent
f8e6b6ecd9
commit
92167aca42
3 changed files with 17 additions and 0 deletions
5
.changeset/friendly-cycles-heal.md
Normal file
5
.changeset/friendly-cycles-heal.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"penpot-exporter": patch
|
||||
---
|
||||
|
||||
Fix masks not working in components
|
|
@ -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(';');
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue