@leafer/path
Advanced tools
+4
-4
| { | ||
| "name": "@leafer/path", | ||
| "version": "1.0.5", | ||
| "version": "1.0.6", | ||
| "description": "@leafer/path", | ||
@@ -25,8 +25,8 @@ "author": "Chao (Leafer) Wan", | ||
| "dependencies": { | ||
| "@leafer/math": "1.0.5", | ||
| "@leafer/debug": "1.0.5" | ||
| "@leafer/math": "1.0.6", | ||
| "@leafer/debug": "1.0.6" | ||
| }, | ||
| "devDependencies": { | ||
| "@leafer/interface": "1.0.5" | ||
| "@leafer/interface": "1.0.6" | ||
| } | ||
| } |
@@ -11,3 +11,3 @@ import { IPointData, ITwoPointBoundsData, IPathCommandData } from '@leafer/interface' | ||
| const { setPoint, addPoint } = TwoPointBoundsHelper | ||
| const { set } = PointHelper | ||
| const { set, toNumberPoints } = PointHelper | ||
| const { M, L, C, Q, Z } = PathCommandMap | ||
@@ -18,3 +18,6 @@ const tempPoint = {} as IPointData | ||
| points(data: IPathCommandData, points: number[], curve?: boolean | number, close?: boolean): void { | ||
| points(data: IPathCommandData, originPoints: number[] | IPointData[], curve?: boolean | number, close?: boolean): void { | ||
| let points = toNumberPoints(originPoints) | ||
| data.push(M, points[0], points[1]) | ||
@@ -21,0 +24,0 @@ |
@@ -102,3 +102,3 @@ import { IPathCommandData, IPointData } from '@leafer/interface' | ||
| drawPoints(data: IPathCommandData, points: number[], curve?: boolean | number, close?: boolean): void { | ||
| drawPoints(data: IPathCommandData, points: number[] | IPointData[], curve?: boolean | number, close?: boolean): void { | ||
| BezierHelper.points(data, points, curve, close) | ||
@@ -105,0 +105,0 @@ } |
+15
-1
@@ -1,2 +0,2 @@ | ||
| import { IPathCommandData, IPointData } from '@leafer/interface' | ||
| import { IPathCommandData, IPathCommandObject, IPointData } from '@leafer/interface' | ||
| import { MathHelper, StringNumberMap } from '@leafer/math' | ||
@@ -306,2 +306,16 @@ import { Debug } from '@leafer/debug' | ||
| 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 | ||
| }, | ||
| copyData(data: IPathCommandData, old: IPathCommandData, index: number, count: number): void { | ||
@@ -308,0 +322,0 @@ for (let i = index, end = index + count; i < end; i++) { |
+4
-3
@@ -1,2 +0,2 @@ | ||
| import { IPathCreator, IPathCommandData, IPathString, IPathDrawer, IBoundsData, ITwoPointBoundsData, IPointData, INumberMap, IStringMap } from '@leafer/interface'; | ||
| import { IPathCreator, IPathCommandData, IPathCommandObject, IPathString, IPointData, IPathDrawer, IBoundsData, ITwoPointBoundsData, INumberMap, IStringMap } from '@leafer/interface'; | ||
@@ -20,2 +20,3 @@ declare const PathHelper: { | ||
| toCanvasData(old: IPathCommandData, curveMode?: boolean): IPathCommandData; | ||
| objectToCanvasData(list: IPathCommandObject[]): IPathCommandData; | ||
| copyData(data: IPathCommandData, old: IPathCommandData, index: number, count: number): void; | ||
@@ -63,3 +64,3 @@ pushData(data: IPathCommandData, strNum: string | number): void; | ||
| drawArc(data: IPathCommandData, x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): void; | ||
| drawPoints(data: IPathCommandData, points: number[], curve?: boolean | number, close?: boolean): void; | ||
| drawPoints(data: IPathCommandData, points: number[] | IPointData[], curve?: boolean | number, close?: boolean): void; | ||
| }; | ||
@@ -81,3 +82,3 @@ | ||
| declare const BezierHelper: { | ||
| points(data: IPathCommandData, points: number[], curve?: boolean | number, close?: boolean): void; | ||
| points(data: IPathCommandData, originPoints: number[] | IPointData[], curve?: boolean | number, close?: boolean): void; | ||
| rect(data: IPathCommandData, x: number, y: number, width: number, height: number): void; | ||
@@ -84,0 +85,0 @@ roundRect(data: IPathCommandData, x: number, y: number, width: number, height: number, radius: number | number[]): void; |
60722
1.37%1196
1.27%+ Added
+ Added
- Removed
- Removed
Updated
Updated