0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 21:53:27 -05:00
penpot-exporter-figma-plugin/plugin-src/translators/vectors/translateCommands.ts
2024-06-19 08:10:20 +02:00

20 lines
648 B
TypeScript

import { Command } from 'svg-path-parser';
import { getRotation, hasRotation } from '@plugin/utils';
import { translateNonRotatedCommands } from '.';
import { translateRotatedCommands } from './translateRotatedCommands';
export const translateCommands = (node: LayoutMixin, commands: Command[]) => {
const rotation = getRotation(node.absoluteTransform);
if (hasRotation(rotation) && node.absoluteBoundingBox) {
return translateRotatedCommands(commands, node.absoluteTransform, node.absoluteBoundingBox);
}
return translateNonRotatedCommands(
commands,
node.absoluteTransform[0][2],
node.absoluteTransform[1][2]
);
};