@leafer-ui/interaction-web 1.7.0 → 1.9.0
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 +4 -4
- package/src/Interaction.ts +5 -5
- package/src/KeyEventHelper.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/interaction-web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "@leafer-ui/interaction-web",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "1.
|
|
26
|
-
"@leafer-ui/core": "1.
|
|
25
|
+
"@leafer/core": "1.9.0",
|
|
26
|
+
"@leafer-ui/core": "1.9.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@leafer/interface": "1.
|
|
29
|
+
"@leafer/interface": "1.9.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/Interaction.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IObject, IPointData, ITimer, IKeepTouchData, ICursorType, IClientPointData } from '@leafer/interface'
|
|
2
|
-
import { MathHelper } from '@leafer/core'
|
|
2
|
+
import { MathHelper, isArray, isObject, isString } from '@leafer/core'
|
|
3
3
|
import { InteractionBase, InteractionHelper, Cursor } from '@leafer-ui/core'
|
|
4
4
|
|
|
5
5
|
import { PointerEventHelper } from './PointerEventHelper'
|
|
@@ -338,16 +338,16 @@ export class Interaction extends InteractionBase {
|
|
|
338
338
|
super.setCursor(cursor)
|
|
339
339
|
const list: ICursorType[] = []
|
|
340
340
|
this.eachCursor(cursor, list)
|
|
341
|
-
if (
|
|
342
|
-
this.canvas.view.style.cursor = list.map(item => (
|
|
341
|
+
if (isObject(list[list.length - 1])) list.push('default')
|
|
342
|
+
this.canvas.view.style.cursor = list.map(item => (isObject(item)) ? `url(${item.url}) ${item.x || 0} ${item.y || 0}` : item).join(',')
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
protected eachCursor(cursor: ICursorType | ICursorType[], list: ICursorType[], level = 0): void {
|
|
346
346
|
level++
|
|
347
|
-
if (cursor
|
|
347
|
+
if (isArray(cursor)) {
|
|
348
348
|
cursor.forEach(item => this.eachCursor(item, list, level))
|
|
349
349
|
} else {
|
|
350
|
-
const custom =
|
|
350
|
+
const custom = isString(cursor) && Cursor.get(cursor)
|
|
351
351
|
if (custom && level < 2) {
|
|
352
352
|
this.eachCursor(custom, list, level)
|
|
353
353
|
} else {
|
package/src/KeyEventHelper.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IKeyEvent } from '@leafer/interface'
|
|
1
|
+
import { IKeyCodes, IKeyEvent } from '@leafer/interface'
|
|
2
2
|
import { InteractionHelper } from '@leafer-ui/core'
|
|
3
3
|
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ export const KeyEventHelper = {
|
|
|
8
8
|
const base = InteractionHelper.getBase(e)
|
|
9
9
|
const data: IKeyEvent = {
|
|
10
10
|
...base,
|
|
11
|
-
code: e.code,
|
|
11
|
+
code: e.code as IKeyCodes,
|
|
12
12
|
key: e.key
|
|
13
13
|
}
|
|
14
14
|
return data
|