mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 13:43:03 -05:00
af81fc7e92
* Implement rotation for vector lines * wip * Improve rotations for lines * add changelog * add layout attributes to line
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import {
|
|
transformBlend,
|
|
transformConstraints,
|
|
transformEffects,
|
|
transformFigmaIds,
|
|
transformLayoutAttributes,
|
|
transformPosition,
|
|
transformProportion,
|
|
transformSceneNode,
|
|
transformStrokes
|
|
} from '@plugin/transformers/partials';
|
|
import { translateLineNode } from '@plugin/translators/vectors';
|
|
|
|
import { PathShape } from '@ui/lib/types/shapes/pathShape';
|
|
|
|
/**
|
|
* In order to match the normal representation of a line in Penpot, we will assume that
|
|
* the line is never rotated, so we calculate its normal position.
|
|
*
|
|
* To represent the line rotated we do take into account the rotation of the line, but only in its content.
|
|
*/
|
|
export const transformLineNode = (node: LineNode, baseX: number, baseY: number): PathShape => {
|
|
return {
|
|
type: 'path',
|
|
name: node.name,
|
|
content: translateLineNode(node, baseX, baseY),
|
|
...transformFigmaIds(node),
|
|
...transformStrokes(node),
|
|
...transformEffects(node),
|
|
...transformPosition(node, baseX, baseY),
|
|
...transformSceneNode(node),
|
|
...transformBlend(node),
|
|
...transformProportion(node),
|
|
...transformLayoutAttributes(node),
|
|
...transformConstraints(node)
|
|
};
|
|
};
|