Skip to content

Commit

Permalink
Fix vector shapes to be more precise with what you draw on figma (#76)
Browse files Browse the repository at this point in the history
* draft

* Add changelog

---------

Co-authored-by: Jordi Sala Morales <[email protected]>
  • Loading branch information
Cenadros and jordisala1991 authored Apr 26, 2024
1 parent 7ed24ea commit 59d70d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-otters-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"penpot-exporter": patch
---

Fix vector shapes to be more precise with what you draw on figma
6 changes: 1 addition & 5 deletions plugin-src/transformers/partials/transformVectorPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 59d70d2

Please sign in to comment.