From 82ac131dfe0e2c85ac426d88511a0339f7021555 Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Fri, 7 Aug 2026 09:08:57 +0300 Subject: [PATCH] fix(fig): preserve divider main-axis position Restore only the centered cross-axis coordinate when carrying effective derived divider geometry through clone recreation. --- .../derived-symbol-data/propagate.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/fig/src/instance-overrides/derived-symbol-data/propagate.ts b/packages/fig/src/instance-overrides/derived-symbol-data/propagate.ts index 0e40ec38e..019b3d536 100644 --- a/packages/fig/src/instance-overrides/derived-symbol-data/propagate.ts +++ b/packages/fig/src/instance-overrides/derived-symbol-data/propagate.ts @@ -97,7 +97,7 @@ function isThinCenteredCrossChild(parent: SceneNode, clone: SceneNode): boolean function thinCloneCrossPosition( graph: OverrideContext['graph'], clone: SceneNode -): NonNullable | null { +): { axis: 'x' | 'y'; position: number } | null { if ( clone.source.format !== null || !clone.componentId || @@ -114,18 +114,20 @@ function thinCloneCrossPosition( if (!parent || !source || sourceLayout?.x === undefined || sourceLayout.y === undefined) return null if (clone.width !== source.width || clone.height !== source.height) return null - return isThinCenteredCrossChild(parent, clone) ? sourceLayout : null + if (!isThinCenteredCrossChild(parent, clone)) return null + return parent.layoutMode === 'HORIZONTAL' + ? { axis: 'y', position: sourceLayout.y } + : { axis: 'x', position: sourceLayout.x } } function restoreThinCloneCrossPositions(ctx: OverrideContext): void { for (const clone of overrideCandidates(ctx.graph, ctx.activeNodeIds)) { - const sourceLayout = thinCloneCrossPosition(ctx.graph, clone) - if (!sourceLayout) continue + const crossPosition = thinCloneCrossPosition(ctx.graph, clone) + if (!crossPosition) continue ctx.graph.updateNode(clone.id, { figmaDerivedLayout: { ...clone.figmaDerivedLayout, - x: sourceLayout.x, - y: sourceLayout.y + [crossPosition.axis]: crossPosition.position } }) }