2024-04-15 06:58:51 -05:00
|
|
|
import { transformDimensionAndPosition } from '@plugin/transformers/partials';
|
2024-04-12 09:52:36 -05:00
|
|
|
import { translateFills } from '@plugin/translators';
|
|
|
|
|
|
|
|
import { FrameShape } from '@ui/lib/types/frame/frameShape';
|
|
|
|
|
|
|
|
import { transformSceneNode } from '.';
|
2024-04-12 06:55:42 -05:00
|
|
|
|
|
|
|
export const transformFrameNode = async (
|
|
|
|
node: FrameNode,
|
|
|
|
baseX: number,
|
|
|
|
baseY: number
|
|
|
|
): Promise<FrameShape> => {
|
|
|
|
return {
|
|
|
|
type: 'frame',
|
|
|
|
name: node.name,
|
|
|
|
fills: translateFills(node.fills, node.width, node.height),
|
|
|
|
children: await Promise.all(
|
|
|
|
node.children.map(child => transformSceneNode(child, baseX + node.x, baseY + node.y))
|
2024-04-15 06:58:51 -05:00
|
|
|
),
|
|
|
|
...transformDimensionAndPosition(node, baseX, baseY)
|
2024-04-12 06:55:42 -05:00
|
|
|
};
|
|
|
|
};
|