Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jordisala1991 committed May 27, 2024
1 parent 7801fc9 commit 1b6aea0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions plugin-src/transformers/partials/transformChildren.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { translateMaskChildren, translateNonMaskChildren } from '@plugin/translators';
import { translateChildren, translateMaskChildren } from '@plugin/translators';

import { Children } from '@ui/lib/types/utils/children';

Expand All @@ -17,6 +17,6 @@ export const transformChildren = async (
return {
children: containsMask
? await translateMaskChildren(node.children, maskIndex, baseX, baseY)
: await translateNonMaskChildren(node.children, baseX, baseY)
: await translateChildren(node.children, baseX, baseY)
};
};
10 changes: 3 additions & 7 deletions plugin-src/translators/translateChildren.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ export const translateMaskChildren = async (
baseY: number
): Promise<PenpotNode[]> => {
const maskChild = children[maskedIndex];
const unmaskedChildren = await translateNonMaskChildren(
children.slice(0, maskedIndex),
baseX,
baseY
);
const maskedChildren = await translateNonMaskChildren(children.slice(maskedIndex), baseX, baseY);
const unmaskedChildren = await translateChildren(children.slice(0, maskedIndex), baseX, baseY);
const maskedChildren = await translateChildren(children.slice(maskedIndex), baseX, baseY);

const maskGroup = {
...transformGroupNodeLike(maskChild, baseX, baseY),
Expand All @@ -34,7 +30,7 @@ export const translateMaskChildren = async (
return [...unmaskedChildren, maskGroup];
};

export const translateNonMaskChildren = async (
export const translateChildren = async (
children: readonly SceneNode[],
baseX: number,
baseY: number
Expand Down

0 comments on commit 1b6aea0

Please sign in to comment.