fix(fig): preserve implicit fixed text sizing
This commit is contained in:
parent
189655de36
commit
1cc4c252dc
|
|
@ -73,6 +73,8 @@
|
|||
|
||||
### Fixed
|
||||
|
||||
- Preserve implicit fixed-size text inside imported Figma auto-layout frames across save and reload.
|
||||
|
||||
- Preserve imported Figma divider-line geometry during auto-layout recomputation, preventing half-pixel shifts on save and reload.
|
||||
|
||||
- Make published package export conditions resolve to files included in npm tarballs.
|
||||
|
|
|
|||
|
|
@ -225,7 +225,10 @@ function serializeTextProps(
|
|||
nc.fontVariations = node.fontVariations.map(fontVariationToKiwi)
|
||||
}
|
||||
const autoResize = resolveTextAutoResize(node, graph)
|
||||
nc.textAutoResize = autoResize
|
||||
const rawNodeFields = effectiveFigmaRawNodeFields(node)
|
||||
if (!node.source.id || autoResize !== 'NONE' || 'textAutoResize' in rawNodeFields) {
|
||||
nc.textAutoResize = autoResize
|
||||
}
|
||||
nc.textAlignHorizontal = node.textAlignHorizontal
|
||||
nc.textAlignVertical = node.textAlignVertical
|
||||
nc.textUserLayoutVersion = 4
|
||||
|
|
|
|||
|
|
@ -271,6 +271,32 @@ describe('text node export', () => {
|
|||
expect(textNc.stackChildAlignSelf).toBeUndefined()
|
||||
})
|
||||
|
||||
test('omits implicit fixed text sizing for imported auto-layout text', async () => {
|
||||
await initCodec()
|
||||
const graph = new SceneGraph()
|
||||
const page = graph.getPages()[0]
|
||||
const frame = graph.createNode('FRAME', page.id, { layoutMode: 'VERTICAL' })
|
||||
const text = graph.createNode('TEXT', frame.id, {
|
||||
text: 'Supporting text',
|
||||
textAutoResize: 'NONE',
|
||||
source: {
|
||||
...frame.source,
|
||||
format: 'fig',
|
||||
id: '1:2',
|
||||
fig: {
|
||||
...frame.source.fig,
|
||||
rawNodeFields: {}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const exported = await exportFigFile(graph)
|
||||
const parsed = await parseFigFile(exported.buffer as ArrayBuffer)
|
||||
const restored = parsed.getAllNodes().find((node) => node.name === text.name)
|
||||
|
||||
expect(restored?.textAutoResize).toBe('NONE')
|
||||
})
|
||||
|
||||
test('style runs produce multiple fontMetaData entries', async () => {
|
||||
await initCodec()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue