diff --git a/plugin-src/transformers/partials/index.ts b/plugin-src/transformers/partials/index.ts index 0f58db1..2efc6ae 100644 --- a/plugin-src/transformers/partials/index.ts +++ b/plugin-src/transformers/partials/index.ts @@ -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'; diff --git a/plugin-src/transformers/partials/transformProportion.ts b/plugin-src/transformers/partials/transformProportion.ts new file mode 100644 index 0000000..a92a118 --- /dev/null +++ b/plugin-src/transformers/partials/transformProportion.ts @@ -0,0 +1,7 @@ +import { ShapeAttributes } from '@ui/lib/types/shape/shapeAttributes'; + +export const transformProportion = (node: LayoutMixin): Partial => { + return { + proportionLock: node.constrainProportions + }; +}; diff --git a/plugin-src/transformers/transformEllipseNode.ts b/plugin-src/transformers/transformEllipseNode.ts index 5fa72b8..c60a32c 100644 --- a/plugin-src/transformers/transformEllipseNode.ts +++ b/plugin-src/transformers/transformEllipseNode.ts @@ -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) }; }; diff --git a/plugin-src/transformers/transformFrameNode.ts b/plugin-src/transformers/transformFrameNode.ts index 3cf9a71..3877186 100644 --- a/plugin-src/transformers/transformFrameNode.ts +++ b/plugin-src/transformers/transformFrameNode.ts @@ -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)) }; }; diff --git a/plugin-src/transformers/transformPathNode.ts b/plugin-src/transformers/transformPathNode.ts index 41aeacf..68ff3aa 100644 --- a/plugin-src/transformers/transformPathNode.ts +++ b/plugin-src/transformers/transformPathNode.ts @@ -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) }; }; diff --git a/plugin-src/transformers/transformRectangleNode.ts b/plugin-src/transformers/transformRectangleNode.ts index 1616f1a..e518f27 100644 --- a/plugin-src/transformers/transformRectangleNode.ts +++ b/plugin-src/transformers/transformRectangleNode.ts @@ -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) }; }; diff --git a/plugin-src/transformers/transformTextNode.ts b/plugin-src/transformers/transformTextNode.ts index 1bad3dd..227db8b 100644 --- a/plugin-src/transformers/transformTextNode.ts +++ b/plugin-src/transformers/transformTextNode.ts @@ -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) }; };