mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 21:53:27 -05:00
e5f2943532
* Implement rotation for frames and sections * wip * finish implementation * add changelog
21 lines
643 B
TypeScript
21 lines
643 B
TypeScript
import { translateChildren, translateMaskChildren } from '@plugin/translators';
|
|
|
|
import { Children } from '@ui/lib/types/utils/children';
|
|
|
|
const nodeActsAsMask = (node: SceneNode): boolean => {
|
|
return 'isMask' in node && node.isMask;
|
|
};
|
|
|
|
export const transformChildren = async (
|
|
node: ChildrenMixin,
|
|
baseRotation: number = 0
|
|
): Promise<Children> => {
|
|
const maskIndex = node.children.findIndex(nodeActsAsMask);
|
|
const containsMask = maskIndex !== -1;
|
|
|
|
return {
|
|
children: containsMask
|
|
? await translateMaskChildren(node.children, maskIndex, baseRotation)
|
|
: await translateChildren(node.children, baseRotation)
|
|
};
|
|
};
|