@leafer/path
Advanced tools
| import { IPathCommandNode, IPathCommandData, IPathNodeBase } from '@leafer/interface' | ||
| // 路径节点辅助(适合可视化编辑),提供接口(需重写) | ||
| export const PathCommandNodeHelper = { | ||
| toCommand(_nodes: IPathCommandNode[] | IPathNodeBase[]): IPathCommandData { | ||
| return [] | ||
| }, | ||
| toNode(_data: IPathCommandData): IPathCommandNode[] { | ||
| return [] | ||
| } | ||
| } |
+5
-5
| { | ||
| "name": "@leafer/path", | ||
| "version": "1.10.1", | ||
| "version": "1.11.0", | ||
| "description": "@leafer/path", | ||
@@ -25,9 +25,9 @@ "author": "Chao (Leafer) Wan", | ||
| "dependencies": { | ||
| "@leafer/data": "1.10.1", | ||
| "@leafer/math": "1.10.1", | ||
| "@leafer/debug": "1.10.1" | ||
| "@leafer/data": "1.11.0", | ||
| "@leafer/math": "1.11.0", | ||
| "@leafer/debug": "1.11.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@leafer/interface": "1.10.1" | ||
| "@leafer/interface": "1.11.0" | ||
| } | ||
| } |
+1
-0
@@ -5,2 +5,3 @@ export { PathHelper } from './PathHelper' | ||
| export { PathCommandDataHelper } from './PathCommandDataHelper' | ||
| export { PathCommandNodeHelper } from './PathCommandNodeHelper' | ||
| export { PathDrawer } from './PathDrawer' | ||
@@ -7,0 +8,0 @@ export { PathBounds } from './PathBounds' |
+18
-13
@@ -1,2 +0,2 @@ | ||
| import { IPathCommandData, IPathCommandObject, IPointData } from '@leafer/interface' | ||
| import { IPathCommandData, IPathCommandNode, IPathCommandObject, IPointData } from '@leafer/interface' | ||
| import { MathHelper, StringNumberMap } from '@leafer/math' | ||
@@ -8,2 +8,3 @@ import { Debug } from '@leafer/debug' | ||
| import { EllipseHelper } from './EllipseHelper' | ||
| import { PathCommandNodeHelper } from './PathCommandNodeHelper' | ||
@@ -307,14 +308,18 @@ | ||
| objectToCanvasData(list: IPathCommandObject[]): IPathCommandData { | ||
| const data: IPathCommandData = [] | ||
| list.forEach(item => { | ||
| switch (item.name) { | ||
| case 'M': data.push(M, item.x, item.y); break | ||
| case 'L': data.push(L, item.x, item.y); break | ||
| case 'C': data.push(C, item.x1, item.y1, item.x2, item.y2, item.x, item.y); break | ||
| case 'Q': data.push(Q, item.x1, item.y1, item.x, item.y); break | ||
| case 'Z': data.push(Z) | ||
| } | ||
| }) | ||
| return data | ||
| objectToCanvasData(list: IPathCommandNode[] | IPathCommandObject[]): IPathCommandData { | ||
| if (list[0].name.length > 1) { // nodes | ||
| return PathCommandNodeHelper.toCommand(list as IPathCommandNode[]) | ||
| } else { | ||
| const data: IPathCommandData = [] | ||
| list.forEach(item => { | ||
| switch (item.name) { | ||
| case 'M': data.push(M, item.x, item.y); break | ||
| case 'L': data.push(L, item.x, item.y); break | ||
| case 'C': data.push(C, item.x1, item.y1, item.x2, item.y2, item.x, item.y); break | ||
| case 'Q': data.push(Q, item.x1, item.y1, item.x, item.y); break | ||
| case 'Z': data.push(Z) | ||
| } | ||
| }) | ||
| return data | ||
| } | ||
| }, | ||
@@ -321,0 +326,0 @@ |
+8
-3
@@ -1,2 +0,2 @@ | ||
| import { IPathCreator, IPathCommandData, IPathCommandObject, IPathString, IPointData, IPathDrawer, IBoundsData, ITwoPointBoundsData, INumberMap, IStringMap } from '@leafer/interface'; | ||
| import { IPathCreator, IPathCommandData, IPathCommandNode, IPathCommandObject, IPathString, IPointData, IPathNodeBase, IPathDrawer, IBoundsData, ITwoPointBoundsData, INumberMap, IStringMap } from '@leafer/interface'; | ||
@@ -20,3 +20,3 @@ declare const PathHelper: { | ||
| toCanvasData(old: IPathCommandData, curveMode?: boolean): IPathCommandData; | ||
| objectToCanvasData(list: IPathCommandObject[]): IPathCommandData; | ||
| objectToCanvasData(list: IPathCommandNode[] | IPathCommandObject[]): IPathCommandData; | ||
| copyData(data: IPathCommandData, old: IPathCommandData, index: number, count: number): void; | ||
@@ -67,2 +67,7 @@ pushData(data: IPathCommandData, strNum: string | number): void; | ||
| declare const PathCommandNodeHelper: { | ||
| toCommand(_nodes: IPathCommandNode[] | IPathNodeBase[]): IPathCommandData; | ||
| toNode(_data: IPathCommandData): IPathCommandNode[]; | ||
| }; | ||
| declare const PathDrawer: { | ||
@@ -112,2 +117,2 @@ drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void; | ||
| export { BezierHelper, EllipseHelper, NeedConvertToCanvasCommandMap, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, RectHelper, path, pen }; | ||
| export { BezierHelper, EllipseHelper, NeedConvertToCanvasCommandMap, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, RectHelper, path, pen }; |
62613
1.64%17
6.25%1231
1.65%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated
Updated
Updated