mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-21 21:23:06 -05:00
added proportion lock to all current nodes that support it (#51)
This commit is contained in:
parent
44d691e7c3
commit
0be073012d
7 changed files with 24 additions and 5 deletions
|
@ -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';
|
||||
|
|
7
plugin-src/transformers/partials/transformProportion.ts
Normal file
7
plugin-src/transformers/partials/transformProportion.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { ShapeAttributes } from '@ui/lib/types/shape/shapeAttributes';
|
||||
|
||||
export const transformProportion = (node: LayoutMixin): Partial<ShapeAttributes> => {
|
||||
return {
|
||||
proportionLock: node.constrainProportions
|
||||
};
|
||||
};
|
|
@ -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)
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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))
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue