mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 13:43:03 -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:
parent
7ed24ea0dd
commit
59d70d2510
2 changed files with 6 additions and 5 deletions
5
.changeset/many-otters-mix.md
Normal file
5
.changeset/many-otters-mix.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"penpot-exporter": patch
|
||||
---
|
||||
|
||||
Fix vector shapes to be more precise with what you draw on figma
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue