@leafer-ui/interaction 1.5.3 → 1.6.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 +6 -6
- package/src/Interaction.ts +14 -8
- package/src/config.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/interaction",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "@leafer-ui/interaction",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "1.
|
|
26
|
-
"@leafer-ui/draw": "1.
|
|
27
|
-
"@leafer-ui/event": "1.
|
|
25
|
+
"@leafer/core": "1.6.1",
|
|
26
|
+
"@leafer-ui/draw": "1.6.1",
|
|
27
|
+
"@leafer-ui/event": "1.6.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@leafer/interface": "1.
|
|
31
|
-
"@leafer-ui/interface": "1.
|
|
30
|
+
"@leafer/interface": "1.6.1",
|
|
31
|
+
"@leafer-ui/interface": "1.6.1"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/src/Interaction.ts
CHANGED
|
@@ -96,8 +96,8 @@ export class InteractionBase implements IInteraction {
|
|
|
96
96
|
public pointerDown(data?: IPointerEvent, useDefaultPath?: boolean): void {
|
|
97
97
|
if (!data) data = this.hoverData
|
|
98
98
|
if (!data) return
|
|
99
|
-
PointerButton.defaultLeft(data)
|
|
100
99
|
|
|
100
|
+
PointerButton.defaultLeft(data)
|
|
101
101
|
this.updateDownData(data)
|
|
102
102
|
this.checkPath(data, useDefaultPath)
|
|
103
103
|
|
|
@@ -137,7 +137,7 @@ export class InteractionBase implements IInteraction {
|
|
|
137
137
|
if (this.downData) {
|
|
138
138
|
const canDrag = PointHelper.getDistance(this.downData, data) > this.p.dragDistance
|
|
139
139
|
if (canDrag) {
|
|
140
|
-
|
|
140
|
+
this.pointerWaitCancel()
|
|
141
141
|
this.waitRightTap = false
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -454,7 +454,9 @@ export class InteractionBase implements IInteraction {
|
|
|
454
454
|
|
|
455
455
|
public getLocal(clientPoint: IClientPointData, updateClient?: boolean): IPointData {
|
|
456
456
|
const clientBounds = this.canvas.getClientBounds(updateClient)
|
|
457
|
-
|
|
457
|
+
const point = { x: clientPoint.clientX - clientBounds.x, y: clientPoint.clientY - clientBounds.y }
|
|
458
|
+
if (this.p.snap) PointHelper.round(point)
|
|
459
|
+
return point
|
|
458
460
|
}
|
|
459
461
|
|
|
460
462
|
|
|
@@ -479,9 +481,11 @@ export class InteractionBase implements IInteraction {
|
|
|
479
481
|
}
|
|
480
482
|
|
|
481
483
|
protected tapWaitCancel(): void {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
484
|
+
if (this.waitTap) {
|
|
485
|
+
clearTimeout(this.tapTimer)
|
|
486
|
+
this.waitTap = false
|
|
487
|
+
this.tapCount = 0
|
|
488
|
+
}
|
|
485
489
|
}
|
|
486
490
|
|
|
487
491
|
protected longPressWait(data: IPointerEvent): void {
|
|
@@ -503,8 +507,10 @@ export class InteractionBase implements IInteraction {
|
|
|
503
507
|
}
|
|
504
508
|
|
|
505
509
|
protected longPressWaitCancel(): void {
|
|
506
|
-
|
|
507
|
-
|
|
510
|
+
if (this.longPressTimer) {
|
|
511
|
+
clearTimeout(this.longPressTimer)
|
|
512
|
+
this.longPressed = false
|
|
513
|
+
}
|
|
508
514
|
}
|
|
509
515
|
|
|
510
516
|
protected __onResize(): void {
|