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:
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 './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';
|
||||||
|
|
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,
|
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)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -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))
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -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)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -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)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -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)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue