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:
parent
65a06d761c
commit
c95d442e74
2 changed files with 10 additions and 7 deletions
5
.changeset/lemon-jars-think.md
Normal file
5
.changeset/lemon-jars-think.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'penpot-exporter': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixed issue where big vectors are making the plugin crash
|
|
@ -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(
|
||||||
|
|
Loading…
Reference in a new issue