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

Fix for huge vectors crashing the plugin (#220)

* fixed big vectors issue

* fixes
This commit is contained in:
Alex Sánchez 2024-09-20 09:02:30 +02:00 committed by GitHub
parent 65a06d761c
commit c95d442e74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 7 deletions

View file

@ -0,0 +1,5 @@
---
'penpot-exporter': patch
---
Fixed issue where big vectors are making the plugin crash

View file

@ -14,16 +14,14 @@ import { translateCommands, translateWindingRule } from '@plugin/translators/vec
import { PathShape } from '@ui/lib/types/shapes/pathShape'; import { PathShape } from '@ui/lib/types/shapes/pathShape';
export const transformVectorPaths = (node: VectorNode): PathShape[] => { export const transformVectorPaths = (node: VectorNode): PathShape[] => {
const regions = node.vectorNetwork?.regions ?? [];
const strokeLength = node.strokes.length;
const pathShapes = node.vectorPaths const pathShapes = node.vectorPaths
.filter((vectorPath, index) => { .filter((vectorPath, index) => {
return ( return nodeHasFills(node, vectorPath, regions[index]) || strokeLength > 0;
nodeHasFills(node, vectorPath, (node.vectorNetwork.regions ?? [])[index]) ||
node.strokes.length > 0
);
}) })
.map((vectorPath, index) => .map((vectorPath, index) => transformVectorPath(node, vectorPath, regions[index]));
transformVectorPath(node, vectorPath, (node.vectorNetwork.regions ?? [])[index])
);
const geometryShapes = node.fillGeometry const geometryShapes = node.fillGeometry
.filter( .filter(