Skip to content

Commit 72f2fb8

Browse files
committed
fix(refresher): PTR in desktop. Fixes #4758
1 parent cff02a5 commit 72f2fb8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: js/angular/controller/refresherController.js

+20
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ IonicModule
3939
$onPulling: '&onPulling'
4040
});
4141

42+
function handleMousedown(e) {
43+
e.touches = e.touches || [{
44+
screenX: e.screenX,
45+
screenY: e.screenY
46+
}];
47+
// Mouse needs this
48+
startY = parseInt(e.touches[0].screenY, 10);
49+
}
50+
4251
function handleTouchend() {
4352
// if this wasn't an overscroll, get out immediately
4453
if (!canOverscroll && !isDragging) {
@@ -69,6 +78,11 @@ IonicModule
6978
}
7079

7180
function handleTouchmove(e) {
81+
e.touches = e.touches || [{
82+
screenX: e.screenX,
83+
screenY: e.screenY
84+
}];
85+
7286
// if multitouch or regular scroll event, get out immediately
7387
if (!canOverscroll || e.touches.length > 1) {
7488
return;
@@ -249,6 +263,9 @@ IonicModule
249263

250264
ionic.on('touchmove', handleTouchmove, scrollChild);
251265
ionic.on('touchend', handleTouchend, scrollChild);
266+
ionic.on('mousedown', handleMousedown, scrollChild);
267+
ionic.on('mousemove', handleTouchmove, scrollChild);
268+
ionic.on('mouseup', handleTouchend, scrollChild);
252269
ionic.on('scroll', handleScroll, scrollParent);
253270

254271
// cleanup when done
@@ -258,6 +275,9 @@ IonicModule
258275
function destroy() {
259276
ionic.off('touchmove', handleTouchmove, scrollChild);
260277
ionic.off('touchend', handleTouchend, scrollChild);
278+
ionic.off('mousedown', handleMousedown, scrollChild);
279+
ionic.off('mousemove', handleTouchmove, scrollChild);
280+
ionic.off('mouseup', handleTouchend, scrollChild);
261281
ionic.off('scroll', handleScroll, scrollParent);
262282
scrollParent = null;
263283
scrollChild = null;

0 commit comments

Comments
 (0)