0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-01-08 16:10:07 -05:00
penpot-exporter-figma-plugin/plugin-src/transformers/transformPolygonNode.ts
Jordi Sala Morales 73ccf83657
Vectors - Pen & pencil (#35)
* path shapes

* add polygon node

* wip vector

* implement translation of commands and paths

* vectors and polygon

* strokes

* star

* deformed shapes

* simplify star

* simplify star

* fix transformers

---------

Co-authored-by: Alex Sánchez <sion333@gmail.com>
2024-04-16 16:08:39 +02:00

25 lines
755 B
TypeScript

import {
transformBlend,
transformDimensionAndPosition,
transformSceneNode
} from '@plugin/transformers/partials';
import { translateFills, translateStrokes, translateVectorPaths } from '@plugin/translators';
import { PathShape } from '@ui/lib/types/path/pathShape';
export const transformPolygonNode = (
node: DefaultShapeMixin,
baseX: number,
baseY: number
): PathShape => {
return {
type: 'path',
name: node.name,
content: translateVectorPaths(node.fillGeometry, baseX + node.x, baseY + node.y),
strokes: translateStrokes(node),
fills: translateFills(node.fills, node.width, node.height),
...transformDimensionAndPosition(node, baseX, baseY),
...transformSceneNode(node),
...transformBlend(node)
};
};