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
Alex Sánchez 3da80b4c26
Fix transformed shapes (#236)
* fix transformed shapes

* minor fix
2024-11-14 15:42:45 +01:00

18 lines
622 B
TypeScript

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