2024-06-14 03:33:23 -05:00
|
|
|
import {
|
|
|
|
transformBlend,
|
|
|
|
transformConstraints,
|
|
|
|
transformEffects,
|
|
|
|
transformFigmaIds,
|
|
|
|
transformLayoutAttributes,
|
|
|
|
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.
|
|
|
|
*/
|
2024-06-14 09:28:01 -05:00
|
|
|
export const transformLineNode = (node: LineNode, baseRotation: number): PathShape => {
|
2024-06-14 03:33:23 -05:00
|
|
|
return {
|
|
|
|
type: 'path',
|
|
|
|
name: node.name,
|
2024-06-14 09:28:01 -05:00
|
|
|
content: translateLineNode(node, baseRotation),
|
2024-06-14 03:33:23 -05:00
|
|
|
...transformFigmaIds(node),
|
|
|
|
...transformStrokes(node),
|
|
|
|
...transformEffects(node),
|
|
|
|
...transformSceneNode(node),
|
|
|
|
...transformBlend(node),
|
|
|
|
...transformProportion(node),
|
|
|
|
...transformLayoutAttributes(node),
|
|
|
|
...transformConstraints(node)
|
|
|
|
};
|
|
|
|
};
|