fix(kiwi): preserve pattern spacing
This commit is contained in:
parent
6a036acf89
commit
a79d671873
|
|
@ -79,6 +79,7 @@ function applyImagePaintFields(fill: Fill, p: Paint): void {
|
|||
|
||||
function applySchemaPaintFields(fill: Fill, p: Paint): void {
|
||||
if (p.sourceNodeId) fill.sourceNodeId = guidToString(p.sourceNodeId)
|
||||
if (p.spacing) fill.spacing = p.spacing
|
||||
if (p.patternSpacing) fill.patternSpacing = p.patternSpacing
|
||||
if (p.patternTileType) fill.patternTileType = p.patternTileType as Fill['patternTileType']
|
||||
if (p.verticalAlignment) fill.verticalAlignment = p.verticalAlignment as Fill['verticalAlignment']
|
||||
|
|
|
|||
|
|
@ -218,6 +218,7 @@ function fillToKiwiPaint(f: SceneNode['fills'][number]): Paint {
|
|||
if (f.imageScaleMode) paint.imageScaleMode = f.imageScaleMode
|
||||
if (f.imageTransform) paint.transform = f.imageTransform
|
||||
if (f.sourceNodeId) paint.sourceNodeId = stringToGuid(f.sourceNodeId)
|
||||
if (f.spacing) paint.spacing = f.spacing
|
||||
if (f.patternSpacing) paint.patternSpacing = f.patternSpacing
|
||||
if (f.patternTileType) paint.patternTileType = f.patternTileType
|
||||
if (f.verticalAlignment) paint.verticalAlignment = f.verticalAlignment
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@ export interface Fill {
|
|||
imageScaleMode?: ImageScaleMode
|
||||
imageTransform?: GradientTransform
|
||||
sourceNodeId?: string
|
||||
spacing?: number
|
||||
patternSpacing?: Vector
|
||||
patternTileType?: PatternTileType
|
||||
verticalAlignment?: PatternAlignment
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ describe('Figma paint schema field export', () => {
|
|||
opacity: 0.75,
|
||||
visible: true,
|
||||
sourceNodeId: '12:34',
|
||||
spacing: 6,
|
||||
patternSpacing: { x: 8, y: 12 },
|
||||
patternTileType: 'VERTICAL_HEXAGONAL',
|
||||
verticalAlignment: 'CENTER',
|
||||
|
|
@ -45,6 +46,7 @@ describe('Figma paint schema field export', () => {
|
|||
expect(fills?.[0]).toMatchObject({
|
||||
type: 'PATTERN',
|
||||
sourceNodeId: { sessionID: 12, localID: 34 },
|
||||
spacing: 6,
|
||||
patternSpacing: { x: 8, y: 12 },
|
||||
patternTileType: 'VERTICAL_HEXAGONAL',
|
||||
verticalAlignment: 'CENTER',
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ describe('Figma paint schema field import', () => {
|
|||
opacity: 0.75,
|
||||
visible: true,
|
||||
sourceNodeId,
|
||||
spacing: 6,
|
||||
patternSpacing: { x: 8, y: 12 },
|
||||
patternTileType: 'HORIZONTAL_HEXAGONAL',
|
||||
verticalAlignment: 'CENTER',
|
||||
|
|
@ -32,6 +33,7 @@ describe('Figma paint schema field import', () => {
|
|||
type: 'PATTERN',
|
||||
opacity: 0.75,
|
||||
sourceNodeId: '12:34',
|
||||
spacing: 6,
|
||||
patternSpacing: { x: 8, y: 12 },
|
||||
patternTileType: 'HORIZONTAL_HEXAGONAL',
|
||||
verticalAlignment: 'CENTER',
|
||||
|
|
|
|||
Loading…
Reference in a new issue