@leafer/path 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/src/PathConvert.ts +7 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/path",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "@leafer/path",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/data": "2.1.
|
|
26
|
-
"@leafer/math": "2.1.
|
|
27
|
-
"@leafer/debug": "2.1.
|
|
25
|
+
"@leafer/data": "2.1.3",
|
|
26
|
+
"@leafer/math": "2.1.3",
|
|
27
|
+
"@leafer/debug": "2.1.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@leafer/interface": "2.1.
|
|
30
|
+
"@leafer/interface": "2.1.3"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/PathConvert.ts
CHANGED
|
@@ -79,7 +79,10 @@ export const PathConvert = {
|
|
|
79
79
|
current.index = 0
|
|
80
80
|
pushData(data, current.name)
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
// m/M命令连续数据需转成l/L: m1 1 2 2m5 5 6 6
|
|
83
|
+
if (char === 'm') current.name = Command['l']
|
|
84
|
+
else if (char === 'M') current.name = Command['L']
|
|
85
|
+
else if (!needConvert && convertCommand[char]) needConvert = true
|
|
83
86
|
|
|
84
87
|
} else {
|
|
85
88
|
|
|
@@ -122,12 +125,9 @@ export const PathConvert = {
|
|
|
122
125
|
old[i + 1] += x
|
|
123
126
|
old[i + 2] += y
|
|
124
127
|
case M:
|
|
125
|
-
x = old[i + 1]
|
|
126
|
-
y = old[i + 2]
|
|
127
|
-
|
|
128
|
-
if (lastCommand === command) data.push(L, x, y) // M command followed by multiple coordinates
|
|
129
|
-
else data.push(M, x, y), startX = x, startY = y
|
|
130
|
-
|
|
128
|
+
x = startX = old[i + 1]
|
|
129
|
+
y = startY = old[i + 2]
|
|
130
|
+
data.push(M, x, y)
|
|
131
131
|
i += 3
|
|
132
132
|
break
|
|
133
133
|
|