0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 05:33:02 -05:00

added proportion lock to all current nodes that support it (#51)

This commit is contained in:
Alex Sánchez 2024-04-19 12:18:12 +02:00 committed by GitHub
parent 44d691e7c3
commit 0be073012d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 24 additions and 5 deletions

View file

@ -2,6 +2,7 @@ export * from './transformBlend';
export * from './transformChildren';
export * from './transformDimensionAndPosition';
export * from './transformFills';
export * from './transformProportion';
export * from './transformSceneNode';
export * from './transformStrokes';
export * from './transformTextStyle';

View file

@ -0,0 +1,7 @@
import { ShapeAttributes } from '@ui/lib/types/shape/shapeAttributes';
export const transformProportion = (node: LayoutMixin): Partial<ShapeAttributes> => {
return {
proportionLock: node.constrainProportions
};
};

View file

@ -2,6 +2,7 @@ import {
transformBlend,
transformDimensionAndPosition,
transformFills,
transformProportion,
transformSceneNode,
transformStrokes
} from '@plugin/transformers/partials';
@ -20,6 +21,7 @@ export const transformEllipseNode = (
...transformStrokes(node),
...transformDimensionAndPosition(node, baseX, baseY),
...transformSceneNode(node),
...transformBlend(node)
...transformBlend(node),
...transformProportion(node)
};
};

View file

@ -3,6 +3,7 @@ import {
transformChildren,
transformDimensionAndPosition,
transformFills,
transformProportion,
transformSceneNode,
transformStrokes
} from '@plugin/transformers/partials';
@ -33,6 +34,8 @@ export const transformFrameNode = async (
// they plan to add it in the future. Refactor this when available.
// @see: https://forum.figma.com/t/add-a-blendmode-property-for-sectionnode/58560
...(isSectionNode(node) ? [] : transformBlend(node)),
...transformSceneNode(node)
...transformSceneNode(node),
// Figma API does not expose constraints proportions for sections
...(isSectionNode(node) ? [] : transformProportion(node))
};
};

View file

@ -2,6 +2,7 @@ import {
transformBlend,
transformDimensionAndPosition,
transformFills,
transformProportion,
transformSceneNode,
transformStrokes,
transformVectorPaths
@ -25,6 +26,7 @@ export const transformPathNode = (
...transformVectorPaths(node, baseX, baseY),
...transformDimensionAndPosition(node, baseX, baseY),
...transformSceneNode(node),
...transformBlend(node)
...transformBlend(node),
...transformProportion(node)
};
};

View file

@ -2,6 +2,7 @@ import {
transformBlend,
transformDimensionAndPosition,
transformFills,
transformProportion,
transformSceneNode,
transformStrokes
} from '@plugin/transformers/partials';
@ -20,6 +21,7 @@ export const transformRectangleNode = (
...transformStrokes(node),
...transformDimensionAndPosition(node, baseX, baseY),
...transformSceneNode(node),
...transformBlend(node)
...transformBlend(node),
...transformProportion(node)
};
};

View file

@ -2,6 +2,7 @@ import {
transformBlend,
transformDimensionAndPosition,
transformFills,
transformProportion,
transformSceneNode,
transformTextStyle
} from '@plugin/transformers/partials';
@ -42,6 +43,7 @@ export const transformTextNode = (node: TextNode, baseX: number, baseY: number):
},
...transformDimensionAndPosition(node, baseX, baseY),
...transformSceneNode(node),
...transformBlend(node)
...transformBlend(node),
...transformProportion(node)
};
};