@leafer-ui/bounds 1.0.0-bate → 1.0.0-beta

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 +10 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/bounds",
3
- "version": "1.0.0-bate",
3
+ "version": "1.0.0-beta",
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-bate"
22
+ "@leafer/core": "1.0.0-beta"
23
23
  },
24
24
  "devDependencies": {
25
- "@leafer-ui/interface": "1.0.0-bate"
25
+ "@leafer-ui/interface": "1.0.0-beta"
26
26
  }
27
27
  }
package/src/UIBounds.ts CHANGED
@@ -6,22 +6,21 @@ import { IUIBoundsModule } from "@leafer-ui/interface"
6
6
  export const UIBounds: IUIBoundsModule = {
7
7
 
8
8
  __updateStrokeSpread(): number {
9
- let width: number = 0
9
+ let width = 0, boxWidth = 0
10
10
  const { stroke, hitStroke, strokeAlign, strokeWidth } = this.__
11
11
 
12
12
  if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
13
- width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth
14
- this.__layout.shapeStrokeSpread = width
13
+ boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth
15
14
 
16
- const { miterLimit, strokeCap, path } = this.__
17
- if (path) {
18
- const miterLimitAddWidth = 1 / Math.sin(miterLimit * OneRadian / 2) * Math.sqrt(strokeWidth) - width
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
19
18
  const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth
20
19
  width += Math.max(miterLimitAddWidth, storkeCapAddWidth)
21
20
  }
22
21
  }
23
22
 
24
- if (!width) this.__layout.shapeStrokeSpread = 0
23
+ this.__layout.strokeBoxSpread = boxWidth
25
24
 
26
25
  return width
27
26
  },
@@ -36,15 +35,15 @@ export const UIBounds: IUIBoundsModule = {
36
35
 
37
36
  if (blur) width = Math.max(width, blur)
38
37
 
39
- let other = width = Math.ceil(width)
38
+ let shapeWidth = width = Math.ceil(width)
40
39
 
41
40
  if (innerShadow) innerShadow.forEach(item => {
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)
41
+ shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5)
43
42
  })
44
43
 
44
+ if (backgroundBlur) shapeWidth = Math.max(shapeWidth, backgroundBlur)
45
45
 
46
- if (backgroundBlur) other = Math.max(other, backgroundBlur)
47
- this.__layout.shapeRenderSpread = other
46
+ this.__layout.renderShapeSpread = shapeWidth
48
47
 
49
48
  return width
50
49
  }