2024-06-17 05:14:16 -05:00
|
|
|
import { parseSVG } from 'svg-path-parser';
|
|
|
|
|
2024-04-16 09:08:39 -05:00
|
|
|
import {
|
|
|
|
transformBlend,
|
2024-06-06 05:17:17 -05:00
|
|
|
transformConstraints,
|
2024-04-22 07:35:59 -05:00
|
|
|
transformEffects,
|
2024-05-30 10:54:37 -05:00
|
|
|
transformFigmaIds,
|
2024-04-17 08:27:53 -05:00
|
|
|
transformFills,
|
2024-06-14 03:18:34 -05:00
|
|
|
transformLayoutAttributes,
|
2024-06-17 02:58:23 -05:00
|
|
|
transformOverrides,
|
2024-04-19 05:18:12 -05:00
|
|
|
transformProportion,
|
2024-06-17 05:14:16 -05:00
|
|
|
transformRotation,
|
2024-04-17 03:53:38 -05:00
|
|
|
transformSceneNode,
|
2024-06-14 03:33:23 -05:00
|
|
|
transformStrokes
|
2024-04-16 09:08:39 -05:00
|
|
|
} from '@plugin/transformers/partials';
|
2024-06-17 05:14:16 -05:00
|
|
|
import { translateCommands } from '@plugin/translators/vectors';
|
2024-04-16 09:08:39 -05:00
|
|
|
|
2024-06-17 05:14:16 -05:00
|
|
|
import { PathShape, Segment } from '@ui/lib/types/shapes/pathShape';
|
2024-04-16 09:08:39 -05:00
|
|
|
|
2024-06-19 01:10:20 -05:00
|
|
|
export const transformPathNode = (node: StarNode | PolygonNode): PathShape => {
|
2024-04-16 09:08:39 -05:00
|
|
|
return {
|
2024-05-13 06:21:46 -05:00
|
|
|
type: 'path',
|
2024-04-16 09:08:39 -05:00
|
|
|
name: node.name,
|
2024-06-19 01:10:20 -05:00
|
|
|
content: translatePathNode(node),
|
2024-05-30 10:54:37 -05:00
|
|
|
...transformFigmaIds(node),
|
2024-06-14 03:33:23 -05:00
|
|
|
...transformFills(node),
|
2024-06-05 05:36:49 -05:00
|
|
|
...transformStrokes(node),
|
2024-04-22 07:35:59 -05:00
|
|
|
...transformEffects(node),
|
2024-04-16 09:08:39 -05:00
|
|
|
...transformSceneNode(node),
|
2024-04-19 05:18:12 -05:00
|
|
|
...transformBlend(node),
|
2024-06-06 05:17:17 -05:00
|
|
|
...transformProportion(node),
|
2024-06-19 01:10:20 -05:00
|
|
|
...transformRotation(node),
|
2024-06-14 03:18:34 -05:00
|
|
|
...transformLayoutAttributes(node),
|
2024-06-17 02:58:23 -05:00
|
|
|
...transformConstraints(node),
|
|
|
|
...transformOverrides(node)
|
2024-04-16 09:08:39 -05:00
|
|
|
};
|
|
|
|
};
|
2024-06-17 05:14:16 -05:00
|
|
|
|
2024-06-19 01:10:20 -05:00
|
|
|
const translatePathNode = (node: StarNode | PolygonNode): Segment[] =>
|
|
|
|
translateCommands(node, parseSVG(node.fillGeometry[0].data));
|