2024-06-17 05:14:16 -05:00
|
|
|
import { Command } from 'svg-path-parser';
|
|
|
|
|
2024-06-19 01:10:20 -05:00
|
|
|
import { getRotation, hasRotation } from '@plugin/utils';
|
2024-06-17 05:14:16 -05:00
|
|
|
|
|
|
|
import { translateNonRotatedCommands } from '.';
|
|
|
|
import { translateRotatedCommands } from './translateRotatedCommands';
|
|
|
|
|
2024-06-19 01:10:20 -05:00
|
|
|
export const translateCommands = (node: LayoutMixin, commands: Command[]) => {
|
|
|
|
const rotation = getRotation(node.absoluteTransform);
|
|
|
|
|
|
|
|
if (hasRotation(rotation) && node.absoluteBoundingBox) {
|
2024-06-17 05:14:16 -05:00
|
|
|
return translateRotatedCommands(commands, node.absoluteTransform, node.absoluteBoundingBox);
|
|
|
|
}
|
|
|
|
|
|
|
|
return translateNonRotatedCommands(
|
|
|
|
commands,
|
|
|
|
node.absoluteTransform[0][2],
|
|
|
|
node.absoluteTransform[1][2]
|
|
|
|
);
|
|
|
|
};
|