@leafer-ui/bounds 1.0.0-alpha.23 → 1.0.0-alpha.31

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 +13 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/bounds",
3
- "version": "1.0.0-alpha.23",
3
+ "version": "1.0.0-alpha.31",
4
4
  "description": "@leafer-ui/bounds",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -19,9 +19,9 @@
19
19
  "leaferjs"
20
20
  ],
21
21
  "dependencies": {
22
- "@leafer/core": "1.0.0-alpha.23"
22
+ "@leafer/core": "1.0.0-alpha.31"
23
23
  },
24
24
  "devDependencies": {
25
- "@leafer-ui/interface": "1.0.0-alpha.23"
25
+ "@leafer-ui/interface": "1.0.0-alpha.31"
26
26
  }
27
27
  }
package/src/UIBounds.ts CHANGED
@@ -7,20 +7,21 @@ export const UIBounds: IUIBoundsModule = {
7
7
 
8
8
  __updateStrokeBoundsSpreadWidth(): number {
9
9
  let width: number = 0
10
- const { stroke, strokeAlign } = this.__
10
+ const { stroke, hitStroke, strokeAlign, strokeWidth } = this.__
11
11
 
12
- if (stroke && strokeAlign !== 'inside') {
13
-
14
- const { strokeWidth, miterLimit, path } = this.__
15
- const miterLength = path ? 1 / Math.sin(miterLimit * OneRadian / 2) * Math.sqrt(strokeWidth) : 0 // miterlimit 导致增加的长度
12
+ if ((stroke || hitStroke === 'always') && strokeWidth && strokeAlign !== 'inside') {
16
13
  width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth
17
- this.__.__strokeOuterWidth = width
18
-
19
- if (miterLength) width += (miterLength - width)
20
-
14
+ this.__layout.shapeStrokeSpreadWidth = width
15
+
16
+ const { miterLimit, strokeCap, path } = this.__
17
+ if (path) {
18
+ const miterLimitAddWidth = 1 / Math.sin(miterLimit * OneRadian / 2) * Math.sqrt(strokeWidth) - width
19
+ const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth
20
+ width += Math.max(miterLimitAddWidth, storkeCapAddWidth)
21
+ }
21
22
  }
22
23
 
23
- if (!width) this.__.__strokeOuterWidth = 0
24
+ if (!width) this.__layout.shapeStrokeSpreadWidth = 0
24
25
 
25
26
  return width
26
27
  },
@@ -35,15 +36,15 @@ export const UIBounds: IUIBoundsModule = {
35
36
 
36
37
  if (blur) width = Math.max(width, blur)
37
38
 
38
-
39
39
  let other = width = Math.ceil(width)
40
40
 
41
41
  if (innerShadow) innerShadow.forEach(item => {
42
42
  other = Math.max(other, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5)
43
43
  })
44
44
 
45
+
45
46
  if (backgroundBlur) other = Math.max(other, backgroundBlur)
46
- this.__layout.renderShapeBoundsSpreadWidth = other
47
+ this.__layout.shapeRenderSpreadWidth = other
47
48
 
48
49
  return width
49
50
  }