@leafer-ui/hit 1.0.4 → 1.0.5

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.4",
3
+ "version": "1.0.5",
4
4
  "description": "@leafer-ui/hit",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -13,20 +13,20 @@
13
13
  ],
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "https://github.com/leaferjs/ui.git"
16
+ "url": "https://github.com/leaferjs/leafer-ui.git"
17
17
  },
18
- "homepage": "https://github.com/leaferjs/ui/tree/main/packages/hit",
19
- "bugs": "https://github.com/leaferjs/ui/issues",
18
+ "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/hit",
19
+ "bugs": "https://github.com/leaferjs/leafer-ui/issues",
20
20
  "keywords": [
21
21
  "leafer-ui",
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.0.4",
26
- "@leafer-ui/draw": "1.0.4"
25
+ "@leafer/core": "1.0.5",
26
+ "@leafer-ui/draw": "1.0.5"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.0.4",
30
- "@leafer-ui/interface": "1.0.4"
29
+ "@leafer/interface": "1.0.5",
30
+ "@leafer-ui/interface": "1.0.5"
31
31
  }
32
32
  }
package/src/RectHit.ts CHANGED
@@ -1,18 +1,17 @@
1
1
  import { IRadiusPointData } from '@leafer/interface'
2
2
  import { BoundsHelper } from '@leafer/core'
3
- import { Rect, UI } from '@leafer-ui/draw'
3
+ import { UI, Rect, Box } from '@leafer-ui/draw'
4
4
 
5
5
 
6
- const ui = new UI()
7
- const rect = Rect.prototype
6
+ const ui = UI.prototype, rect = Rect.prototype, box = Box.prototype
8
7
 
9
8
  // hit
10
9
 
11
- rect.__updateHitCanvas = function () {
10
+ rect.__updateHitCanvas = box.__updateHitCanvas = function () {
12
11
  if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all') ui.__updateHitCanvas.call(this)
13
12
  else if (this.__hitCanvas) this.__hitCanvas = null
14
13
  }
15
14
 
16
- rect.__hitFill = function (inner: IRadiusPointData): boolean {
15
+ rect.__hitFill = box.__hitFill = function (inner: IRadiusPointData): boolean {
17
16
  return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner)
18
17
  }
package/src/UIHit.ts CHANGED
@@ -20,7 +20,7 @@ ui.__updateHitCanvas = function (): void {
20
20
  if (isHitPixel) {
21
21
  const { renderBounds } = this.__layout
22
22
  const size = Platform.image.hitCanvasSize
23
- const scale = h.hitScale = tempBounds.set(0, 0, size, size).getFitMatrix(renderBounds, 0.5).a
23
+ const scale = h.hitScale = tempBounds.set(0, 0, size, size).getFitMatrix(renderBounds).a
24
24
  const { x, y, width, height } = tempBounds.set(renderBounds).scale(scale)
25
25
  h.resize({ width, height, pixelRatio: 1 })
26
26
  h.clear()