0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-01-03 05:10:13 -05:00
penpot-exporter-figma-plugin/plugin-src/transformers/transformGroupNode.ts
Alex Sánchez 9f5f05d2a9
zIndex
2024-06-14 08:15:49 +02:00

41 lines
1 KiB
TypeScript

import {
transformBlend,
transformDimensionAndPosition,
transformEffects,
transformFigmaIds,
transformLayoutItemZIndex,
transformSceneNode
} from '@plugin/transformers/partials';
import { transformChildren } from '@plugin/transformers/partials';
import { GroupShape } from '@ui/lib/types/shapes/groupShape';
export const transformGroupNode = async (
node: GroupNode,
baseX: number,
baseY: number,
zIndex: number
): Promise<GroupShape> => {
return {
...transformFigmaIds(node),
...transformGroupNodeLike(node, baseX, baseY, zIndex),
...transformEffects(node),
...transformBlend(node),
...(await transformChildren(node, baseX, baseY))
};
};
export const transformGroupNodeLike = (
node: BaseNodeMixin & DimensionAndPositionMixin & SceneNodeMixin,
baseX: number,
baseY: number,
zIndex: number
): GroupShape => {
return {
type: 'group',
name: node.name,
...transformLayoutItemZIndex(zIndex),
...transformDimensionAndPosition(node, baseX, baseY),
...transformSceneNode(node)
};
};