mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2025-01-03 05:10:13 -05:00
202e7f4fda
* Apply rotations to any figure * add changelog * apply rotations to curves too
33 lines
764 B
TypeScript
33 lines
764 B
TypeScript
import { ShapeBaseAttributes } from '@ui/lib/types/shapes/shape';
|
|
|
|
export const translateRotation = (
|
|
transform: Transform,
|
|
rotation: number
|
|
): Pick<ShapeBaseAttributes, 'transform' | 'transformInverse' | 'rotation'> => ({
|
|
rotation: -rotation < 0 ? -rotation + 360 : -rotation,
|
|
transform: {
|
|
a: transform[0][0],
|
|
b: transform[1][0],
|
|
c: transform[0][1],
|
|
d: transform[1][1],
|
|
e: 0,
|
|
f: 0
|
|
},
|
|
transformInverse: {
|
|
a: transform[0][0],
|
|
b: transform[0][1],
|
|
c: transform[1][0],
|
|
d: transform[1][1],
|
|
e: 0,
|
|
f: 0
|
|
}
|
|
});
|
|
|
|
export const translateZeroRotation = (): Pick<
|
|
ShapeBaseAttributes,
|
|
'transform' | 'transformInverse' | 'rotation'
|
|
> => ({
|
|
rotation: 0,
|
|
transform: undefined,
|
|
transformInverse: undefined
|
|
});
|