0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 21:53:27 -05:00
penpot-exporter-figma-plugin/plugin-src/transformers/transformFrameNode.ts
2024-04-12 18:52:19 +02:00

24 lines
628 B
TypeScript

import { translateFills } from '@plugin/translators';
import { FrameShape } from '@ui/lib/types/frame/frameShape';
import { transformSceneNode } from '.';
export const transformFrameNode = async (
node: FrameNode,
baseX: number,
baseY: number
): Promise<FrameShape> => {
return {
type: 'frame',
name: node.name,
x: node.x + baseX,
y: node.y + baseY,
width: node.width,
height: node.height,
fills: translateFills(node.fills, node.width, node.height),
children: await Promise.all(
node.children.map(child => transformSceneNode(child, baseX + node.x, baseY + node.y))
)
};
};