@@ -48,6 +48,15 @@ IonicModule
48
48
startY = Math . floor ( e . touches [ 0 ] . screenY ) ;
49
49
}
50
50
51
+ function handleTouchstart ( e ) {
52
+ e . touches = e . touches || [ {
53
+ screenX : e . screenX ,
54
+ screenY : e . screenY
55
+ } ] ;
56
+
57
+ startY = e . touches [ 0 ] . screenY ;
58
+ }
59
+
51
60
function handleTouchend ( ) {
52
61
// reset Y
53
62
startY = null ;
@@ -97,14 +106,16 @@ IonicModule
97
106
startY = e . touches [ 0 ] . screenY ;
98
107
}
99
108
109
+ deltaY = e . touches [ 0 ] . screenY - startY ;
110
+
111
+ // how far have we dragged so far?
100
112
// kitkat fix for touchcancel events http://updates.html5rocks.com/2014/05/A-More-Compatible-Smoother-Touch
101
- if ( ionic . Platform . isAndroid ( ) && ionic . Platform . version ( ) === 4.4 && scrollParent . scrollTop === 0 ) {
113
+ // Only do this if we're not on crosswalk
114
+ if ( ionic . Platform . isAndroid ( ) && ionic . Platform . version ( ) === 4.4 && ! ionic . Platform . isCrosswalk ( ) && scrollParent . scrollTop === 0 && deltaY > 0 ) {
102
115
isDragging = true ;
103
116
e . preventDefault ( ) ;
104
117
}
105
118
106
- // how far have we dragged so far?
107
- deltaY = e . touches [ 0 ] . screenY - startY ;
108
119
109
120
// if we've dragged up and back down in to native scroll territory
110
121
if ( deltaY - dragOffset <= 0 || scrollParent . scrollTop !== 0 ) {
@@ -257,17 +268,17 @@ IonicModule
257
268
}
258
269
259
270
260
- var touchMoveEvent , touchEndEvent ;
271
+ var touchStartEvent , touchMoveEvent , touchEndEvent ;
261
272
if ( window . navigator . pointerEnabled ) {
262
- // touchStartEvent = 'pointerdown';
273
+ touchStartEvent = 'pointerdown' ;
263
274
touchMoveEvent = 'pointermove' ;
264
275
touchEndEvent = 'pointerup' ;
265
276
} else if ( window . navigator . msPointerEnabled ) {
266
- // touchStartEvent = 'MSPointerDown';
277
+ touchStartEvent = 'MSPointerDown' ;
267
278
touchMoveEvent = 'MSPointerMove' ;
268
279
touchEndEvent = 'MSPointerUp' ;
269
280
} else {
270
- // touchStartEvent = 'touchstart';
281
+ touchStartEvent = 'touchstart' ;
271
282
touchMoveEvent = 'touchmove' ;
272
283
touchEndEvent = 'touchend' ;
273
284
}
@@ -282,6 +293,7 @@ IonicModule
282
293
}
283
294
284
295
296
+ ionic . on ( touchStartEvent , handleTouchstart , scrollChild ) ;
285
297
ionic . on ( touchMoveEvent , handleTouchmove , scrollChild ) ;
286
298
ionic . on ( touchEndEvent , handleTouchend , scrollChild ) ;
287
299
ionic . on ( 'mousedown' , handleMousedown , scrollChild ) ;
@@ -294,6 +306,7 @@ IonicModule
294
306
} ;
295
307
296
308
function destroy ( ) {
309
+ ionic . off ( touchStartEvent , handleTouchstart , scrollChild ) ;
297
310
ionic . off ( touchMoveEvent , handleTouchmove , scrollChild ) ;
298
311
ionic . off ( touchEndEvent , handleTouchend , scrollChild ) ;
299
312
ionic . off ( 'mousedown' , handleMousedown , scrollChild ) ;
0 commit comments