0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-01-03 05:10:13 -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 './transformChildren';
export * from './transformDimensionAndPosition'; export * from './transformDimensionAndPosition';
export * from './transformFills'; export * from './transformFills';
export * from './transformProportion';
export * from './transformSceneNode'; export * from './transformSceneNode';
export * from './transformStrokes'; export * from './transformStrokes';
export * from './transformTextStyle'; 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, transformBlend,
transformDimensionAndPosition, transformDimensionAndPosition,
transformFills, transformFills,
transformProportion,
transformSceneNode, transformSceneNode,
transformStrokes transformStrokes
} from '@plugin/transformers/partials'; } from '@plugin/transformers/partials';
@ -20,6 +21,7 @@ export const transformEllipseNode = (
...transformStrokes(node), ...transformStrokes(node),
...transformDimensionAndPosition(node, baseX, baseY), ...transformDimensionAndPosition(node, baseX, baseY),
...transformSceneNode(node), ...transformSceneNode(node),
...transformBlend(node) ...transformBlend(node),
...transformProportion(node)
}; };
}; };

View file

@ -3,6 +3,7 @@ import {
transformChildren, transformChildren,
transformDimensionAndPosition, transformDimensionAndPosition,
transformFills, transformFills,
transformProportion,
transformSceneNode, transformSceneNode,
transformStrokes transformStrokes
} from '@plugin/transformers/partials'; } from '@plugin/transformers/partials';
@ -33,6 +34,8 @@ export const transformFrameNode = async (
// they plan to add it in the future. Refactor this when available. // 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 // @see: https://forum.figma.com/t/add-a-blendmode-property-for-sectionnode/58560
...(isSectionNode(node) ? [] : transformBlend(node)), ...(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, transformBlend,
transformDimensionAndPosition, transformDimensionAndPosition,
transformFills, transformFills,
transformProportion,
transformSceneNode, transformSceneNode,
transformStrokes, transformStrokes,
transformVectorPaths transformVectorPaths
@ -25,6 +26,7 @@ export const transformPathNode = (
...transformVectorPaths(node, baseX, baseY), ...transformVectorPaths(node, baseX, baseY),
...transformDimensionAndPosition(node, baseX, baseY), ...transformDimensionAndPosition(node, baseX, baseY),
...transformSceneNode(node), ...transformSceneNode(node),
...transformBlend(node) ...transformBlend(node),
...transformProportion(node)
}; };
}; };

View file

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

View file

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