@leafer/selector 1.12.0 → 1.12.2

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/Picker.ts +10 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/selector",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "description": "@leafer/selector",
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.12.0"
25
+ "@leafer/core": "1.12.2"
26
26
  },
27
27
  "devDependencies": {
28
- "@leafer/interface": "1.12.0"
28
+ "@leafer/interface": "1.12.2"
29
29
  }
30
30
  }
package/src/Picker.ts CHANGED
@@ -1,9 +1,12 @@
1
- import { ILeaf, ILeafList, IPointData, IRadiusPointData, IPickResult, IPickOptions, ISelector, IPickBottom, IPicker, ILeaferBase } from '@leafer/interface'
2
- import { BoundsHelper, LeafList, LeafHelper } from '@leafer/core'
1
+ import { ILeaf, ILeafList, IPointData, IRadiusPointData, IPickResult, IPickOptions, ISelector, IPickBottom, IPicker, ILeaferBase, ILeafData } from '@leafer/interface'
2
+ import { BoundsHelper, LeafList, LeafHelper, PointHelper } from '@leafer/core'
3
3
 
4
4
 
5
+ const tempPoint = {} as IRadiusPointData
6
+ const { copyRadiusPoint } = PointHelper
5
7
  const { hitRadiusPoint } = BoundsHelper
6
8
 
9
+
7
10
  export class Picker implements IPicker {
8
11
 
9
12
  protected target?: ILeaf
@@ -143,16 +146,16 @@ export class Picker implements IPicker {
143
146
  }
144
147
 
145
148
  protected eachFind(children: ILeaf[], hitMask: boolean): void {
146
- let child: ILeaf, hit: boolean
149
+ let child: ILeaf, hit: boolean, data: ILeafData
147
150
  const { point } = this, len = children.length
148
151
  for (let i = len - 1; i > -1; i--) {
149
- child = children[i]
150
- if (!child.__.visible || (hitMask && !child.__.mask)) continue
151
- hit = child.__.hitRadius ? true : hitRadiusPoint(child.__world, point)
152
+ child = children[i], data = child.__
153
+ if (!data.visible || (hitMask && !data.mask)) continue
154
+ hit = hitRadiusPoint(child.__world, data.hitRadius ? copyRadiusPoint(tempPoint, point, data.hitRadius) : point)
152
155
 
153
156
  if (child.isBranch) {
154
157
  if (hit || child.__ignoreHitWorld) {
155
- if (child.isBranchLeaf && child.__.__clipAfterFill && !child.__hitWorld(point)) continue // 裁剪的Box需要先检测自身是否碰撞到
158
+ if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue // 裁剪的Box需要先检测自身是否碰撞到
156
159
  if (child.topChildren) this.eachFind(child.topChildren, false) // 滚动条等覆盖物
157
160
  this.eachFind(child.children, child.__onlyHitMask)
158
161
  if (child.isBranchLeaf) this.hitChild(child, point) // Box / Frame