chore: add notes

This commit is contained in:
Yanyan-Wang 2023-11-01 15:40:46 +08:00
parent 06c4990271
commit 85ff6cc962

View File

@ -57,6 +57,11 @@ const PATH_COMMANDS = {
a: ['rx', 'ry', 'rotation', 'large-arc', 'sweep', 'dx', 'dy'],
};
/**
* Converts a path string to an array of path segments.
* @param {string} path - The path string to convert.
* @returns {Array} - An array of path segments.
**/
const fromPathToArray = (path: string) => {
const items = path
.replace(/[\n\r]/g, '')
@ -89,6 +94,11 @@ const fromPathToArray = (path: string) => {
return segments;
};
/**
* Converts a path to an array of points.
* @param {Array|string} path - The path to convert to points.
* @returns {Array} - An array of points.
*/
export const pathToPoints = (path: any[] | string) => {
const points = [];
let segments = [];