@leafer/path 2.1.3 → 2.1.4
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 +6 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/path",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
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.4",
|
|
26
|
+
"@leafer/math": "2.1.4",
|
|
27
|
+
"@leafer/debug": "2.1.4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@leafer/interface": "2.1.
|
|
30
|
+
"@leafer/interface": "2.1.4"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/PathConvert.ts
CHANGED
|
@@ -82,7 +82,8 @@ export const PathConvert = {
|
|
|
82
82
|
// m/M命令连续数据需转成l/L: m1 1 2 2m5 5 6 6
|
|
83
83
|
if (char === 'm') current.name = Command['l']
|
|
84
84
|
else if (char === 'M') current.name = Command['L']
|
|
85
|
-
|
|
85
|
+
|
|
86
|
+
if (!needConvert && convertCommand[char]) needConvert = true
|
|
86
87
|
|
|
87
88
|
} else {
|
|
88
89
|
|
|
@@ -169,8 +170,8 @@ export const PathConvert = {
|
|
|
169
170
|
command = S
|
|
170
171
|
case S:
|
|
171
172
|
smooth = (lastCommand === C) || (lastCommand === S)
|
|
172
|
-
x1 = smooth ? (x * 2 - controlX) :
|
|
173
|
-
y1 = smooth ? (y * 2 - controlY) :
|
|
173
|
+
x1 = smooth ? (x * 2 - controlX) : x
|
|
174
|
+
y1 = smooth ? (y * 2 - controlY) : y
|
|
174
175
|
controlX = old[i + 1]
|
|
175
176
|
controlY = old[i + 2]
|
|
176
177
|
x = old[i + 3]
|
|
@@ -204,8 +205,8 @@ export const PathConvert = {
|
|
|
204
205
|
command = T
|
|
205
206
|
case T: //smooth
|
|
206
207
|
smooth = (lastCommand === Q) || (lastCommand === T)
|
|
207
|
-
controlX = smooth ? (x * 2 - controlX) :
|
|
208
|
-
controlY = smooth ? (y * 2 - controlY) :
|
|
208
|
+
controlX = smooth ? (x * 2 - controlX) : x
|
|
209
|
+
controlY = smooth ? (y * 2 - controlY) : y
|
|
209
210
|
curveMode ? quadraticCurveTo(data, x, y, controlX, controlY, old[i + 1], old[i + 2]) : data.push(Q, controlX, controlY, old[i + 1], old[i + 2])
|
|
210
211
|
x = old[i + 1]
|
|
211
212
|
y = old[i + 2]
|