Skip to content

Commit

Permalink
Fix for huge vectors crashing the plugin (#220)
Browse files Browse the repository at this point in the history
* fixed big vectors issue

* fixes
  • Loading branch information
Cenadros authored Sep 20, 2024
1 parent 65a06d7 commit c95d442
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-jars-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'penpot-exporter': patch
---

Fixed issue where big vectors are making the plugin crash
12 changes: 5 additions & 7 deletions plugin-src/transformers/partials/transformVectorPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ import { translateCommands, translateWindingRule } from '@plugin/translators/vec
import { PathShape } from '@ui/lib/types/shapes/pathShape';

export const transformVectorPaths = (node: VectorNode): PathShape[] => {
const regions = node.vectorNetwork?.regions ?? [];
const strokeLength = node.strokes.length;

const pathShapes = node.vectorPaths
.filter((vectorPath, index) => {
return (
nodeHasFills(node, vectorPath, (node.vectorNetwork.regions ?? [])[index]) ||
node.strokes.length > 0
);
return nodeHasFills(node, vectorPath, regions[index]) || strokeLength > 0;
})
.map((vectorPath, index) =>
transformVectorPath(node, vectorPath, (node.vectorNetwork.regions ?? [])[index])
);
.map((vectorPath, index) => transformVectorPath(node, vectorPath, regions[index]));

const geometryShapes = node.fillGeometry
.filter(
Expand Down

0 comments on commit c95d442

Please sign in to comment.