From 18d1a5dab7ed52b4263bee7006568e042f718148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20S=C3=A1nchez?= Date: Thu, 13 Jun 2024 15:56:38 +0200 Subject: [PATCH] fixes --- plugin-src/transformers/partials/transformLayout.ts | 6 +++++- plugin-src/translators/translateLayout.ts | 13 ++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/plugin-src/transformers/partials/transformLayout.ts b/plugin-src/transformers/partials/transformLayout.ts index a256207..2a0e7ba 100644 --- a/plugin-src/transformers/partials/transformLayout.ts +++ b/plugin-src/transformers/partials/transformLayout.ts @@ -16,7 +16,11 @@ export const transformAutoLayout = (node: BaseFrameMixin): LayoutAttributes => { return { layout: node.layoutMode !== 'NONE' ? 'flex' : undefined, layoutFlexDir: translateLayoutFlexDir(node.layoutMode), - layoutGap: translateLayoutGap(node.layoutMode, node.itemSpacing), + layoutGap: translateLayoutGap( + node.layoutMode, + node.itemSpacing, + node.primaryAxisAlignItems === 'SPACE_BETWEEN' + ), layoutWrapType: translateLayoutWrapType(node.layoutWrap), layoutPadding: translateLayoutPadding(node), layoutJustifyContent: translateLayoutJustifyContent(node), diff --git a/plugin-src/translators/translateLayout.ts b/plugin-src/translators/translateLayout.ts index d2b595c..f24544d 100644 --- a/plugin-src/translators/translateLayout.ts +++ b/plugin-src/translators/translateLayout.ts @@ -25,7 +25,18 @@ export const translateLayoutFlexDir = (layoutMode: FigmaLayoutMode): LayoutFlexD } }; -export const translateLayoutGap = (layoutMode: FigmaLayoutMode, itemSpacing: number): LayoutGap => { +export const translateLayoutGap = ( + layoutMode: FigmaLayoutMode, + itemSpacing: number, + auto: boolean = false +): LayoutGap => { + if (auto) { + return { + rowGap: 0, + columnGap: 0 + }; + } + return { rowGap: layoutMode === 'VERTICAL' ? itemSpacing : 0, columnGap: layoutMode === 'HORIZONTAL' ? itemSpacing : 0