@leafer/path 1.0.2 → 1.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/path",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "@leafer/path",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,10 +22,10 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/math": "1.0.2",
26
- "@leafer/debug": "1.0.2"
25
+ "@leafer/math": "1.0.3",
26
+ "@leafer/debug": "1.0.3"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.0.2"
29
+ "@leafer/interface": "1.0.3"
30
30
  }
31
31
  }
@@ -5,6 +5,7 @@ import { PathCommandMap } from './PathCommandMap'
5
5
  import { RectHelper } from './RectHelper'
6
6
  import { PathHelper } from './PathHelper'
7
7
 
8
+
8
9
  const { sin, cos, atan2, ceil, abs, PI, sqrt, pow } = Math
9
10
  const { setPoint, addPoint } = TwoPointBoundsHelper
10
11
  const { set } = PointHelper
@@ -158,7 +159,7 @@ export const BezierHelper = {
158
159
 
159
160
  let fromX = cx + x, fromY = cy + y
160
161
 
161
- if (data) data.push(L, fromX, fromY)
162
+ if (data) data.push(data.length ? L : M, fromX, fromY)
162
163
  if (setPointBounds) setPoint(setPointBounds, fromX, fromY)
163
164
  if (setStartPoint) set(setStartPoint, fromX, fromY)
164
165
 
@@ -251,6 +252,7 @@ export const BezierHelper = {
251
252
  getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, point)
252
253
  return point
253
254
  }
255
+
254
256
  }
255
257
 
256
258
  const { getPointAndSet, toTwoPointBounds, ellipse } = BezierHelper
package/src/PathBounds.ts CHANGED
@@ -26,8 +26,7 @@ export const PathBounds = {
26
26
  toTwoPointBounds(data: IPathCommandData, setPointBounds: ITwoPointBoundsData): void {
27
27
  if (!data || !data.length) return setPoint(setPointBounds, 0, 0)
28
28
 
29
- let command: number
30
- let i: number = 0, x: number = 0, y: number = 0, x1: number, y1: number, toX: number, toY: number
29
+ let i = 0, x = 0, y = 0, x1: number, y1: number, toX: number, toY: number, command: number
31
30
 
32
31
  const len = data.length
33
32