2024-06-14 03:33:23 -05:00
|
|
|
import { parseSVG } from 'svg-path-parser';
|
2024-04-16 09:08:39 -05:00
|
|
|
|
2024-05-06 01:06:14 -05:00
|
|
|
import { Segment } from '@ui/lib/types/shapes/pathShape';
|
2024-04-16 09:08:39 -05:00
|
|
|
|
2024-06-14 03:33:23 -05:00
|
|
|
import { translateCommandsToSegments } from '.';
|
|
|
|
|
2024-04-16 09:08:39 -05:00
|
|
|
export const translateVectorPaths = (
|
|
|
|
paths: VectorPaths,
|
|
|
|
baseX: number,
|
|
|
|
baseY: number
|
|
|
|
): Segment[] => {
|
2024-06-14 03:33:23 -05:00
|
|
|
const segments: Segment[] = [];
|
2024-04-16 09:08:39 -05:00
|
|
|
|
|
|
|
for (const path of paths) {
|
2024-06-14 03:33:23 -05:00
|
|
|
segments.push(...translateCommandsToSegments(parseSVG(path.data), baseX, baseY));
|
2024-04-16 09:08:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return segments;
|
|
|
|
};
|