@leafer/path
Advanced tools
+4
-4
| { | ||
| "name": "@leafer/path", | ||
| "version": "1.0.0-beta.7", | ||
| "version": "1.0.0-beta.8", | ||
| "description": "@leafer/path", | ||
@@ -22,8 +22,8 @@ "author": "Chao (Leafer) Wan", | ||
| "dependencies": { | ||
| "@leafer/math": "1.0.0-beta.7", | ||
| "@leafer/debug": "1.0.0-beta.7" | ||
| "@leafer/math": "1.0.0-beta.8", | ||
| "@leafer/debug": "1.0.0-beta.8" | ||
| }, | ||
| "devDependencies": { | ||
| "@leafer/interface": "1.0.0-beta.7" | ||
| "@leafer/interface": "1.0.0-beta.8" | ||
| } | ||
| } |
+16
-7
@@ -14,2 +14,3 @@ import { IPathCommandData, IPointData } from '@leafer/interface' | ||
| index?: number | ||
| dot?: number | ||
| } | ||
@@ -27,3 +28,3 @@ | ||
| current: {} as ICurrentCommand, | ||
| current: { dot: 0 } as ICurrentCommand, | ||
@@ -64,2 +65,9 @@ stringify(data: IPathCommandData): string { | ||
| if (char === '.') { | ||
| current.dot++ | ||
| if (current.dot > 1) { | ||
| pushData(data, num); num = '' // .375.375 | ||
| } | ||
| } | ||
| num += char | ||
@@ -69,3 +77,3 @@ | ||
| if (num) { pushData(data, Number(num)); num = '' } | ||
| if (num) { pushData(data, num); num = '' } | ||
@@ -86,3 +94,3 @@ current.name = Command[char] | ||
| } else { | ||
| if (num) pushData(data, Number(num)) // L-34-35 L+12+28 | ||
| if (num) pushData(data, num) // L-34-35 L+12+28 | ||
| num = char | ||
@@ -92,3 +100,3 @@ } | ||
| } else { | ||
| if (num) { pushData(data, Number(num)); num = '' } | ||
| if (num) { pushData(data, num); num = '' } | ||
| } | ||
@@ -102,3 +110,3 @@ | ||
| if (num) pushData(data, Number(num)) | ||
| if (num) pushData(data, num) | ||
@@ -311,3 +319,3 @@ return needConvert ? PathConvert.toCanvasData(data, curveMode) : data | ||
| pushData(data: IPathCommandData, num: number) { | ||
| pushData(data: IPathCommandData, strNum: string | number) { | ||
| if (current.index === current.length) { // 单个命令,多个数据的情况 | ||
@@ -318,4 +326,5 @@ current.index = 1 | ||
| data.push(num) | ||
| data.push(Number(strNum)) | ||
| current.index++ | ||
| current.dot = 0 | ||
| } | ||
@@ -322,0 +331,0 @@ |
46605
0.56%959
0.84%+ Added
+ Added
- Removed
- Removed
Updated
Updated