mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
fix(tapClick): remove mousemove listener
This commit is contained in:
@ -39,6 +39,13 @@ export class TapClick {
|
|||||||
addListener('mousedown', this.mouseDown.bind(this), true);
|
addListener('mousedown', this.mouseDown.bind(this), true);
|
||||||
addListener('mouseup', this.mouseUp.bind(this), true);
|
addListener('mouseup', this.mouseUp.bind(this), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.pointerMove = function(ev) {
|
||||||
|
console.log('pointerMove');
|
||||||
|
if ( hasPointerMoved(POINTER_MOVE_UNTIL_CANCEL, this.startCoord, pointerCoord(ev)) ) {
|
||||||
|
this.pointerCancel(ev);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
touchStart(ev) {
|
touchStart(ev) {
|
||||||
@ -117,12 +124,6 @@ export class TapClick {
|
|||||||
this.activator && this.activator.upAction();
|
this.activator && this.activator.upAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
pointerMove(ev) {
|
|
||||||
if ( hasPointerMoved(POINTER_MOVE_UNTIL_CANCEL, this.startCoord, pointerCoord(ev)) ) {
|
|
||||||
this.pointerCancel(ev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pointerCancel(ev) {
|
pointerCancel(ev) {
|
||||||
console.debug('pointerCancel from', ev.type);
|
console.debug('pointerCancel from', ev.type);
|
||||||
this.activator && this.activator.clearState();
|
this.activator && this.activator.clearState();
|
||||||
@ -130,11 +131,13 @@ export class TapClick {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moveListeners(shouldAdd) {
|
moveListeners(shouldAdd) {
|
||||||
|
removeListener(this.usePolyfill ? 'touchmove' : 'mousemove', this.pointerMove);
|
||||||
|
|
||||||
this.zone.runOutsideAngular(() => {
|
this.zone.runOutsideAngular(() => {
|
||||||
if (shouldAdd) {
|
if (shouldAdd) {
|
||||||
addListener(this.usePolyfill ? 'touchmove' : 'mousemove', this.pointerMove.bind(this));
|
addListener(this.usePolyfill ? 'touchmove' : 'mousemove', this.pointerMove);
|
||||||
} else {
|
} else {
|
||||||
removeListener(this.usePolyfill ? 'touchmove' : 'mousemove', this.pointerMove.bind(this));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user