From 72f2fb8051f658a8673a126eb27f5014c2186e25 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Sun, 13 Dec 2015 20:24:03 -0600 Subject: [PATCH] fix(refresher): PTR in desktop. Fixes #4758 --- js/angular/controller/refresherController.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/js/angular/controller/refresherController.js b/js/angular/controller/refresherController.js index af7b7f8dda0..02b3d9ab18e 100644 --- a/js/angular/controller/refresherController.js +++ b/js/angular/controller/refresherController.js @@ -39,6 +39,15 @@ IonicModule $onPulling: '&onPulling' }); + function handleMousedown(e) { + e.touches = e.touches || [{ + screenX: e.screenX, + screenY: e.screenY + }]; + // Mouse needs this + startY = parseInt(e.touches[0].screenY, 10); + } + function handleTouchend() { // if this wasn't an overscroll, get out immediately if (!canOverscroll && !isDragging) { @@ -69,6 +78,11 @@ IonicModule } function handleTouchmove(e) { + e.touches = e.touches || [{ + screenX: e.screenX, + screenY: e.screenY + }]; + // if multitouch or regular scroll event, get out immediately if (!canOverscroll || e.touches.length > 1) { return; @@ -249,6 +263,9 @@ IonicModule ionic.on('touchmove', handleTouchmove, scrollChild); ionic.on('touchend', handleTouchend, scrollChild); + ionic.on('mousedown', handleMousedown, scrollChild); + ionic.on('mousemove', handleTouchmove, scrollChild); + ionic.on('mouseup', handleTouchend, scrollChild); ionic.on('scroll', handleScroll, scrollParent); // cleanup when done @@ -258,6 +275,9 @@ IonicModule function destroy() { ionic.off('touchmove', handleTouchmove, scrollChild); ionic.off('touchend', handleTouchend, scrollChild); + ionic.off('mousedown', handleMousedown, scrollChild); + ionic.off('mousemove', handleTouchmove, scrollChild); + ionic.off('mouseup', handleTouchend, scrollChild); ionic.off('scroll', handleScroll, scrollParent); scrollParent = null; scrollChild = null;