@leafer-ui/bounds 1.5.2 → 1.6.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 +3 -3
  2. package/src/UIBounds.ts +9 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/bounds",
3
- "version": "1.5.2",
3
+ "version": "1.6.0",
4
4
  "description": "@leafer-ui/bounds",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,9 +22,9 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.5.2"
25
+ "@leafer/core": "1.6.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@leafer-ui/interface": "1.5.2"
28
+ "@leafer-ui/interface": "1.6.0"
29
29
  }
30
30
  }
package/src/UIBounds.ts CHANGED
@@ -7,7 +7,7 @@ export const UIBounds: IUIBoundsModule = {
7
7
 
8
8
  __updateStrokeSpread(): number {
9
9
  let width = 0, boxWidth = 0
10
- const data = this.__, { strokeAlign, strokeWidth } = data
10
+ const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box
11
11
 
12
12
  if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
13
13
  boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth
@@ -21,6 +21,11 @@ export const UIBounds: IUIBoundsModule = {
21
21
 
22
22
  if (data.__useArrow) width += strokeWidth * 5 // 后期需要精细化
23
23
 
24
+ if (box) {
25
+ width = Math.max(box.__layout.strokeSpread = box.__updateStrokeSpread(), width)
26
+ boxWidth = box.__layout.strokeBoxSpread
27
+ }
28
+
24
29
  this.__layout.strokeBoxSpread = boxWidth
25
30
 
26
31
  return width
@@ -44,7 +49,9 @@ export const UIBounds: IUIBoundsModule = {
44
49
 
45
50
  this.__layout.renderShapeSpread = shapeWidth
46
51
 
47
- return width + (this.__layout.strokeSpread || 0)
52
+ width += this.__layout.strokeSpread || 0
53
+
54
+ return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width
48
55
  }
49
56
 
50
57
  }