@leafer/path 1.0.0-alpha.21 → 1.0.0-alpha.23

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.0-alpha.21",
3
+ "version": "1.0.0-alpha.23",
4
4
  "description": "@leafer/path",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -19,9 +19,9 @@
19
19
  "leaferjs"
20
20
  ],
21
21
  "dependencies": {
22
- "@leafer/math": "1.0.0-alpha.21"
22
+ "@leafer/math": "1.0.0-alpha.23"
23
23
  },
24
24
  "devDependencies": {
25
- "@leafer/interface": "1.0.0-alpha.21"
25
+ "@leafer/interface": "1.0.0-alpha.23"
26
26
  }
27
27
  }
@@ -80,7 +80,6 @@ export const PathConvert = {
80
80
 
81
81
  if (num) pushData(data, Number(num))
82
82
 
83
- //console.log(pathString, P._data)
84
83
  return (convert && needConvert) ? PathConvert.convertToSimple(data) : data
85
84
  },
86
85
 
package/src/PathHelper.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IPathDrawer, ITwoPointBoundsData, IPathCommandData } from '@leafer/interface'
1
+ import { IPathDrawer, ITwoPointBoundsData, IPathCommandData, IBoundsData } from '@leafer/interface'
2
2
  import { TwoPointBoundsHelper } from '@leafer/math'
3
3
 
4
4
  import { BezierHelper } from './BezierHelper'
@@ -7,9 +7,10 @@ import { PathCommandMap as Command } from './PathCommandMap'
7
7
 
8
8
  const { M, L, C, Q, Z, ellipse: E } = Command
9
9
  const { toTwoPointBounds } = BezierHelper
10
- const { add, addPoint, setPoint } = TwoPointBoundsHelper
10
+ const { add, addPoint, setPoint, toBounds } = TwoPointBoundsHelper
11
11
 
12
12
  const tempPointBounds = {} as ITwoPointBoundsData
13
+ const setPointBounds = {} as ITwoPointBoundsData
13
14
 
14
15
  export const PathHelper = {
15
16
 
@@ -17,6 +18,11 @@ export const PathHelper = {
17
18
  return data
18
19
  },
19
20
 
21
+ toBounds(data: IPathCommandData, setBounds: IBoundsData): void {
22
+ P.toTwoPointBounds(data, setPointBounds)
23
+ toBounds(setPointBounds, setBounds)
24
+ },
25
+
20
26
  toTwoPointBounds(data: IPathCommandData, setPointBounds: ITwoPointBoundsData): void {
21
27
 
22
28
  let command: number
@@ -112,4 +118,6 @@ export const PathHelper = {
112
118
  }
113
119
  }
114
120
 
115
- }
121
+ }
122
+
123
+ const P = PathHelper