mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 13:43:03 -05:00
decide to transform to path or group based on regions (#110)
This commit is contained in:
parent
3118d36f0a
commit
a734c8a6ac
1 changed files with 5 additions and 3 deletions
|
@ -8,15 +8,17 @@ import { transformGroupNodeLike, transformPathNode } from '.';
|
||||||
/*
|
/*
|
||||||
* Vector nodes can have multiple vector paths, each with its own fills.
|
* 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 there are no regions on the vector network, 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 regions, we treat the vector node as a `GroupShape` with multiple `PathShape` children.
|
||||||
*/
|
*/
|
||||||
export const transformVectorNode = async (
|
export const transformVectorNode = async (
|
||||||
node: VectorNode,
|
node: VectorNode,
|
||||||
baseX: number,
|
baseX: number,
|
||||||
baseY: number
|
baseY: number
|
||||||
): Promise<GroupShape | PathShape> => {
|
): Promise<GroupShape | PathShape> => {
|
||||||
if (node.fills !== figma.mixed) return transformPathNode(node, baseX, baseY);
|
if ((node.vectorNetwork.regions ?? []).length === 0) {
|
||||||
|
return transformPathNode(node, baseX, baseY);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...transformGroupNodeLike(node, baseX, baseY),
|
...transformGroupNodeLike(node, baseX, baseY),
|
||||||
|
|
Loading…
Reference in a new issue