From ae0f66eea8715f8f436681e21c75d62013cd62eb Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Tue, 1 Dec 2015 10:18:07 -0600 Subject: [PATCH] fix(tapClick): remove mousemove listener --- ionic/components/tap-click/tap-click.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ionic/components/tap-click/tap-click.ts b/ionic/components/tap-click/tap-click.ts index 9ab71490dc..92b5e96370 100644 --- a/ionic/components/tap-click/tap-click.ts +++ b/ionic/components/tap-click/tap-click.ts @@ -39,6 +39,13 @@ export class TapClick { addListener('mousedown', this.mouseDown.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) { @@ -117,12 +124,6 @@ export class TapClick { this.activator && this.activator.upAction(); } - pointerMove(ev) { - if ( hasPointerMoved(POINTER_MOVE_UNTIL_CANCEL, this.startCoord, pointerCoord(ev)) ) { - this.pointerCancel(ev); - } - } - pointerCancel(ev) { console.debug('pointerCancel from', ev.type); this.activator && this.activator.clearState(); @@ -130,11 +131,13 @@ export class TapClick { } moveListeners(shouldAdd) { + removeListener(this.usePolyfill ? 'touchmove' : 'mousemove', this.pointerMove); + this.zone.runOutsideAngular(() => { if (shouldAdd) { - addListener(this.usePolyfill ? 'touchmove' : 'mousemove', this.pointerMove.bind(this)); + addListener(this.usePolyfill ? 'touchmove' : 'mousemove', this.pointerMove); } else { - removeListener(this.usePolyfill ? 'touchmove' : 'mousemove', this.pointerMove.bind(this)); + } }); }