0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 05:33:02 -05:00

Fix vector shapes to be more precise with what you draw on figma (#76)

* draft

* Add changelog

---------

Co-authored-by: Jordi Sala Morales <jordism91@gmail.com>
This commit is contained in:
Alex Sánchez 2024-04-26 17:09:57 +02:00 committed by GitHub
parent 7ed24ea0dd
commit 59d70d2510
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View file

@ -0,0 +1,5 @@
---
"penpot-exporter": patch
---
Fix vector shapes to be more precise with what you draw on figma

View file

@ -2,17 +2,13 @@ import { translateVectorPaths } from '@plugin/translators';
import { PathAttributes } from '@ui/lib/types/path/pathAttributes';
const hasFillGeometry = (node: VectorNode | StarNode | LineNode | PolygonNode): boolean => {
return 'fillGeometry' in node && node.fillGeometry.length > 0;
};
const getVectorPaths = (node: VectorNode | StarNode | LineNode | PolygonNode): VectorPaths => {
switch (node.type) {
case 'STAR':
case 'POLYGON':
return node.fillGeometry;
case 'VECTOR':
return hasFillGeometry(node) ? node.fillGeometry : node.vectorPaths;
return node.vectorPaths;
case 'LINE':
return node.strokeGeometry;
}