diff --git a/js/angular/controller/refresherController.js b/js/angular/controller/refresherController.js index e951b5734c4..05b2b3154c4 100644 --- a/js/angular/controller/refresherController.js +++ b/js/angular/controller/refresherController.js @@ -83,6 +83,11 @@ IonicModule screenY: e.screenY }]; + // Force mouse events to have had a down event first + if(!startY && e.type == 'mousemove') { + return; + } + // if multitouch or regular scroll event, get out immediately if (!canOverscroll || e.touches.length > 1) { return; @@ -252,6 +257,21 @@ IonicModule } + var touchStartEvent, touchMoveEvent, touchEndEvent; + if (window.navigator.pointerEnabled) { + touchStartEvent = 'pointerdown'; + touchMoveEvent = 'pointermove'; + touchEndEvent = 'pointerup'; + } else if (window.navigator.msPointerEnabled) { + touchStartEvent = 'MSPointerDown'; + touchMoveEvent = 'MSPointerMove'; + touchEndEvent = 'MSPointerUp'; + } else { + touchStartEvent = 'touchstart'; + touchMoveEvent = 'touchmove'; + touchEndEvent = 'touchend'; + } + self.init = function() { scrollParent = $element.parent().parent()[0]; scrollChild = $element.parent()[0]; @@ -261,8 +281,9 @@ IonicModule throw new Error('Refresher must be immediate child of ion-content or ion-scroll'); } - ionic.on('touchmove', handleTouchmove, scrollChild); - ionic.on('touchend', handleTouchend, scrollChild); + + ionic.on(touchMoveEvent, handleTouchmove, scrollChild); + ionic.on(touchEndEvent, handleTouchend, scrollChild); ionic.on('mousedown', handleMousedown, scrollChild); ionic.on('mousemove', handleTouchmove, scrollChild); ionic.on('mouseup', handleTouchend, scrollChild); @@ -273,8 +294,8 @@ IonicModule }; function destroy() { - ionic.off('touchmove', handleTouchmove, scrollChild); - ionic.off('touchend', handleTouchend, scrollChild); + ionic.off(touchMoveEvent, handleTouchmove, scrollChild); + ionic.off(touchEndEvent, handleTouchend, scrollChild); ionic.off('mousedown', handleMousedown, scrollChild); ionic.off('mousemove', handleTouchmove, scrollChild); ionic.off('mouseup', handleTouchend, scrollChild);