@leafer-ui/hit 2.1.11 → 2.2.1

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": "2.1.11",
3
+ "version": "2.2.1",
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": "2.1.11",
26
- "@leafer-ui/draw": "2.1.11"
25
+ "@leafer/core": "2.2.1",
26
+ "@leafer-ui/draw": "2.2.1"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "2.1.11",
30
- "@leafer-ui/interface": "2.1.11"
29
+ "@leafer/interface": "2.2.1",
30
+ "@leafer-ui/interface": "2.2.1"
31
31
  }
32
32
  }
package/src/TextHit.ts CHANGED
@@ -3,11 +3,11 @@ import { Text } from '@leafer-ui/draw'
3
3
 
4
4
 
5
5
  Text.prototype.__drawHitPath = function (canvas: ILeaferCanvas): void {
6
- const { __lineHeight, fontSize, __baseLine, __letterSpacing, __textDrawData: data } = this.__
6
+ const data = this.__, { __lineHeight, fontSize, __baseLine, __letterSpacing, __textDrawData: drawData } = data
7
7
 
8
8
  canvas.beginPath()
9
9
 
10
- if (__letterSpacing < 0) this.__drawPathByBox(canvas)
11
- else data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight))
12
- }
13
-
10
+ if (data.motionText) this.__drawPathByData(canvas, data.__pathForMotionText)
11
+ else if (__letterSpacing < 0) this.__drawPathByBox(canvas)
12
+ else drawData.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight))
13
+ }
package/src/UIHit.ts CHANGED
@@ -65,8 +65,12 @@ ui.__hit = function (inner: IRadiusPointData, forceHitFill?: boolean): boolean {
65
65
  const radiusWidth = inner.radiusX * 2
66
66
  let hitWidth = radiusWidth
67
67
 
68
+ let { strokeAlign } = data
69
+
70
+ if (data.motionText) hitWidth += data.fontSize / 2, strokeAlign = 'center' // 运动文本
71
+
68
72
  if (needHitStrokePath) {
69
- switch (data.strokeAlign) {
73
+ switch (strokeAlign) {
70
74
  case 'inside':
71
75
  hitWidth += strokeWidth * 2
72
76
  if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth)) return true