From a734c8a6accdd13a3deed673c9fd204267faf904 Mon Sep 17 00:00:00 2001 From: Jordi Sala Morales Date: Tue, 14 May 2024 10:12:18 +0200 Subject: [PATCH] decide to transform to path or group based on regions (#110) --- plugin-src/transformers/transformVectorNode.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin-src/transformers/transformVectorNode.ts b/plugin-src/transformers/transformVectorNode.ts index 8efe819..33f4c7b 100644 --- a/plugin-src/transformers/transformVectorNode.ts +++ b/plugin-src/transformers/transformVectorNode.ts @@ -8,15 +8,17 @@ import { transformGroupNodeLike, transformPathNode } from '.'; /* * Vector nodes can have multiple vector paths, each with its own fills. * - * If the fills are not mixed, we treat it like a normal `PathShape`. - * If the fills are mixed, we treat the vector node as a `GroupShape` with multiple `PathShape` children. + * If there are no regions on the vector network, we treat it like a normal `PathShape`. + * If there are regions, we treat the vector node as a `GroupShape` with multiple `PathShape` children. */ export const transformVectorNode = async ( node: VectorNode, baseX: number, baseY: number ): Promise => { - if (node.fills !== figma.mixed) return transformPathNode(node, baseX, baseY); + if ((node.vectorNetwork.regions ?? []).length === 0) { + return transformPathNode(node, baseX, baseY); + } return { ...transformGroupNodeLike(node, baseX, baseY),