mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2025-01-03 05:10:13 -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';
|
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 => {
|
const getVectorPaths = (node: VectorNode | StarNode | LineNode | PolygonNode): VectorPaths => {
|
||||||
switch (node.type) {
|
switch (node.type) {
|
||||||
case 'STAR':
|
case 'STAR':
|
||||||
case 'POLYGON':
|
case 'POLYGON':
|
||||||
return node.fillGeometry;
|
return node.fillGeometry;
|
||||||
case 'VECTOR':
|
case 'VECTOR':
|
||||||
return hasFillGeometry(node) ? node.fillGeometry : node.vectorPaths;
|
return node.vectorPaths;
|
||||||
case 'LINE':
|
case 'LINE':
|
||||||
return node.strokeGeometry;
|
return node.strokeGeometry;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue