@leafer-ui/bounds 1.0.0-alpha.21 → 1.0.0-alpha.30

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 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/bounds",
3
- "version": "1.0.0-alpha.21",
3
+ "version": "1.0.0-alpha.30",
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.21"
22
+ "@leafer/core": "1.0.0-alpha.30"
23
23
  },
24
24
  "devDependencies": {
25
- "@leafer-ui/interface": "1.0.0-alpha.21"
25
+ "@leafer-ui/interface": "1.0.0-alpha.30"
26
26
  }
27
27
  }
package/src/UIBounds.ts CHANGED
@@ -5,19 +5,20 @@ import { IUIBoundsModule } from "@leafer-ui/interface"
5
5
 
6
6
  export const UIBounds: IUIBoundsModule = {
7
7
 
8
- __updateEventBoundsSpreadWidth(): number {
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
14
  this.__.__strokeOuterWidth = width
18
15
 
19
- if (miterLength) width += (miterLength - width)
20
-
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
24
  if (!width) this.__.__strokeOuterWidth = 0
@@ -35,7 +36,6 @@ 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 => {