(improve)TASK:#109167 add touches into series of pan events

This commit is contained in:
wangchangqi 2022-09-28 16:15:08 +08:00
parent de762c7b21
commit 7ea2da2af9
1 changed files with 10 additions and 4 deletions

View File

@ -82,6 +82,7 @@ export interface TripleTapEvent {
* Event: panstart/panmove/panend * Event: panstart/panmove/panend
*/ */
export interface PanEvent { export interface PanEvent {
readonly touches?: TouchList // 默认指向当前的触摸列表
readonly startTouches?: TouchList readonly startTouches?: TouchList
readonly endTouches?: TouchList readonly endTouches?: TouchList
readonly movingTouches?: TouchList readonly movingTouches?: TouchList
@ -1022,7 +1023,8 @@ export default class GestureDector {
this.emitEvent( this.emitEvent(
'panstart', 'panstart',
Object.freeze({ Object.freeze({
movingTouches: evt.changedTouches, touches: evt.changedTouches,
startTouches: evt.changedTouches,
fingers: evt.touches.length, fingers: evt.touches.length,
}) })
) )
@ -1042,6 +1044,7 @@ export default class GestureDector {
this.emitEvent( this.emitEvent(
'panmove', 'panmove',
Object.freeze({ Object.freeze({
touches: evt.changedTouches,
movingTouches: evt.changedTouches, movingTouches: evt.changedTouches,
fingers: evt.touches.length, fingers: evt.touches.length,
absolute: { absolute: {
@ -1104,6 +1107,7 @@ export default class GestureDector {
this.emitEvent( this.emitEvent(
'panend', 'panend',
Object.freeze({ Object.freeze({
touches: evt.touches,
endTouches: evt.touches, endTouches: evt.touches,
fingers: evt.touches.length, fingers: evt.touches.length,
velocity: this.vc, velocity: this.vc,
@ -1116,19 +1120,21 @@ export default class GestureDector {
this.emitEvent( this.emitEvent(
'pan', 'pan',
Object.freeze({ Object.freeze({
angle: angle, touches: evt.touches,
direction: direction,
endTouches: evt.touches, endTouches: evt.touches,
fingers: evt.touches.length, fingers: evt.touches.length,
angle: angle,
direction: direction,
}) })
) )
} else if (RegExp(direction + '$').test(type)) { } else if (RegExp(direction + '$').test(type)) {
this.emitEvent( this.emitEvent(
type, type,
Object.freeze({ Object.freeze({
angle: angle, touches: evt.touches,
endTouches: evt.touches, endTouches: evt.touches,
fingers: evt.touches.length, fingers: evt.touches.length,
angle: angle,
}) })
) )
} }