@leafer-ui/bounds 1.0.0-rc.9 → 1.0.0

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/UIBounds.ts +8 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/bounds",
3
- "version": "1.0.0-rc.9",
3
+ "version": "1.0.0",
4
4
  "description": "@leafer-ui/bounds",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -15,16 +15,16 @@
15
15
  "type": "git",
16
16
  "url": "https://github.com/leaferjs/ui.git"
17
17
  },
18
- "homepage": "https://github.com/leaferjs/ui/tree/main/packages/bounds",
18
+ "homepage": "https://github.com/leaferjs/ui/tree/main/packages/display-module/bounds",
19
19
  "bugs": "https://github.com/leaferjs/ui/issues",
20
20
  "keywords": [
21
21
  "leafer-ui",
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.0.0-rc.9"
25
+ "@leafer/core": "1.0.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@leafer-ui/interface": "1.0.0-rc.9"
28
+ "@leafer-ui/interface": "1.0.0"
29
29
  }
30
30
  }
package/src/UIBounds.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { OneRadian } from '@leafer/core'
2
-
3
1
  import { IUIBoundsModule } from "@leafer-ui/interface"
4
2
 
5
3
 
@@ -7,19 +5,20 @@ export const UIBounds: IUIBoundsModule = {
7
5
 
8
6
  __updateStrokeSpread(): number {
9
7
  let width = 0, boxWidth = 0
10
- const { stroke, hitStroke, strokeAlign, strokeWidth } = this.__
8
+ const data = this.__, { strokeAlign, strokeWidth } = data
11
9
 
12
- if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
10
+ if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
13
11
  boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth
14
12
 
15
- if (!this.__.__boxStroke) {
16
- const { miterLimit, strokeCap } = this.__
17
- const miterLimitAddWidth = this.__tag !== 'Line' ? 1 / Math.sin(miterLimit * OneRadian / 2) * Math.sqrt(strokeWidth) - width : 0
18
- const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth
13
+ if (!data.__boxStroke) {
14
+ const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width // = Math.sin((miterLimit = 10) * OneRadian / 2) * Math.sqrt(strokeWidth) - width 后期需继续精确优化
15
+ const storkeCapAddWidth = data.strokeCap === 'none' ? 0 : strokeWidth
19
16
  width += Math.max(miterLimitAddWidth, storkeCapAddWidth)
20
17
  }
21
18
  }
22
19
 
20
+ if (data.__useArrow) width += strokeWidth * 5 // 后期需要精细化
21
+
23
22
  this.__layout.strokeBoxSpread = boxWidth
24
23
 
25
24
  return width
@@ -45,7 +44,7 @@ export const UIBounds: IUIBoundsModule = {
45
44
 
46
45
  this.__layout.renderShapeSpread = shapeWidth
47
46
 
48
- return width
47
+ return width + (this.__layout.strokeSpread || 0)
49
48
  }
50
49
 
51
50
  }