mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 13:43:03 -05:00
dddc457281
* wip * wip * fix something? * wip * wip * wip * fixes * fixes * stroke image * wip * fixes * fixes * remove old code * fix translate fills * remove penpot public uri * remove old code * fix return undefineds * updated packages * finish refactor --------- Co-authored-by: Jordi Sala Morales <jordism91@gmail.com>
37 lines
988 B
TypeScript
37 lines
988 B
TypeScript
import { PenpotNode } from '@ui/lib/types/penpotNode';
|
|
|
|
import {
|
|
transformEllipseNode,
|
|
transformFrameNode,
|
|
transformGroupNode,
|
|
transformPathNode,
|
|
transformRectangleNode,
|
|
transformTextNode
|
|
} from '.';
|
|
|
|
export const transformSceneNode = async (
|
|
node: SceneNode,
|
|
baseX: number = 0,
|
|
baseY: number = 0
|
|
): Promise<PenpotNode | undefined> => {
|
|
switch (node.type) {
|
|
case 'RECTANGLE':
|
|
return await transformRectangleNode(node, baseX, baseY);
|
|
case 'ELLIPSE':
|
|
return await transformEllipseNode(node, baseX, baseY);
|
|
case 'SECTION':
|
|
case 'FRAME':
|
|
return await transformFrameNode(node, baseX, baseY);
|
|
case 'GROUP':
|
|
return await transformGroupNode(node, baseX, baseY);
|
|
case 'TEXT':
|
|
return await transformTextNode(node, baseX, baseY);
|
|
case 'STAR':
|
|
case 'POLYGON':
|
|
case 'VECTOR':
|
|
case 'LINE':
|
|
return await transformPathNode(node, baseX, baseY);
|
|
}
|
|
|
|
console.error(`Unsupported node type: ${node.type}`);
|
|
};
|