@leafer-ui/hit 1.0.0-rc.24 → 1.0.0-rc.26

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/hit",
3
- "version": "1.0.0-rc.24",
3
+ "version": "1.0.0-rc.26",
4
4
  "description": "@leafer-ui/hit",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,11 +22,11 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.0.0-rc.24",
26
- "@leafer-ui/draw": "1.0.0-rc.24"
25
+ "@leafer/core": "1.0.0-rc.26",
26
+ "@leafer-ui/draw": "1.0.0-rc.26"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.0.0-rc.24",
30
- "@leafer-ui/interface": "1.0.0-rc.24"
29
+ "@leafer/interface": "1.0.0-rc.26",
30
+ "@leafer-ui/interface": "1.0.0-rc.26"
31
31
  }
32
32
  }
package/src/RectHit.ts CHANGED
@@ -9,7 +9,8 @@ const rect = Rect.prototype
9
9
  // hit
10
10
 
11
11
  rect.__updateHitCanvas = function () {
12
- if (this.stroke || this.cornerRadius) ui.__updateHitCanvas.call(this)
12
+ if (this.stroke || this.cornerRadius || (this.fill && this.hitFill === 'pixel') || this.hitStroke === 'all') ui.__updateHitCanvas.call(this)
13
+ else if (this.__hitCanvas) this.__hitCanvas = null
13
14
  }
14
15
 
15
16
  rect.__hitFill = function (inner: IRadiusPointData): boolean {
package/src/UIHit.ts CHANGED
@@ -51,11 +51,11 @@ ui.__hit = function (inner: IRadiusPointData): boolean {
51
51
  // hit path
52
52
 
53
53
  const { hitFill } = data
54
- const needHitFillPath = ((data.fill && hitFill == 'path') || hitFill === 'all')
54
+ const needHitFillPath = (data.fill && hitFill && hitFill !== 'none') || hitFill === 'all'
55
55
  if (needHitFillPath && this.__hitFill(inner)) return true
56
56
 
57
57
  const { hitStroke, __strokeWidth } = data
58
- const needHitStrokePath = ((data.stroke && hitStroke == 'path') || hitStroke === 'all')
58
+ const needHitStrokePath = (data.stroke && hitFill && hitStroke !== 'none') || hitStroke === 'all'
59
59
  if (!needHitFillPath && !needHitStrokePath) return false
60
60
 
61
61
  const radiusWidth = inner.radiusX * 2
package/src/index.ts CHANGED
@@ -13,7 +13,7 @@ ui.find = function (condition: number | string | IFindUIMethod, options?: any):
13
13
  return this.leafer ? this.leafer.selector.getBy(condition as IFindMethod, this, false, options) as IUI[] : []
14
14
  }
15
15
 
16
- ui.findOne = function (condition: number | string | IFindUIMethod, options?: any): IUI {
16
+ ui.findOne = function (condition: number | string | IFindUIMethod, options?: any): IUI | undefined {
17
17
  return this.leafer ? this.leafer.selector.getBy(condition as IFindMethod, this, true, options) as IUI : null
18
18
  }
19
19
 
@@ -21,4 +21,4 @@ group.pick = function (hitPoint: IPointData, options?: IPickOptions): IPickResul
21
21
  this.__layout.update()
22
22
  if (!options) options = {}
23
23
  return this.leafer ? this.leafer.selector.getByPoint(hitPoint, options.hitRadius || 0, { ...options, target: this }) : null
24
- }
24
+ }