@@ -48,6 +48,15 @@ IonicModule
4848 startY = Math . floor ( e . touches [ 0 ] . screenY ) ;
4949 }
5050
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+
5160 function handleTouchend ( ) {
5261 // reset Y
5362 startY = null ;
@@ -97,14 +106,16 @@ IonicModule
97106 startY = e . touches [ 0 ] . screenY ;
98107 }
99108
109+ deltaY = e . touches [ 0 ] . screenY - startY ;
110+
111+ // how far have we dragged so far?
100112 // 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 ) {
102115 isDragging = true ;
103116 e . preventDefault ( ) ;
104117 }
105118
106- // how far have we dragged so far?
107- deltaY = e . touches [ 0 ] . screenY - startY ;
108119
109120 // if we've dragged up and back down in to native scroll territory
110121 if ( deltaY - dragOffset <= 0 || scrollParent . scrollTop !== 0 ) {
@@ -257,17 +268,17 @@ IonicModule
257268 }
258269
259270
260- var touchMoveEvent , touchEndEvent ;
271+ var touchStartEvent , touchMoveEvent , touchEndEvent ;
261272 if ( window . navigator . pointerEnabled ) {
262- // touchStartEvent = 'pointerdown';
273+ touchStartEvent = 'pointerdown' ;
263274 touchMoveEvent = 'pointermove' ;
264275 touchEndEvent = 'pointerup' ;
265276 } else if ( window . navigator . msPointerEnabled ) {
266- // touchStartEvent = 'MSPointerDown';
277+ touchStartEvent = 'MSPointerDown' ;
267278 touchMoveEvent = 'MSPointerMove' ;
268279 touchEndEvent = 'MSPointerUp' ;
269280 } else {
270- // touchStartEvent = 'touchstart';
281+ touchStartEvent = 'touchstart' ;
271282 touchMoveEvent = 'touchmove' ;
272283 touchEndEvent = 'touchend' ;
273284 }
@@ -282,6 +293,7 @@ IonicModule
282293 }
283294
284295
296+ ionic . on ( touchStartEvent , handleTouchstart , scrollChild ) ;
285297 ionic . on ( touchMoveEvent , handleTouchmove , scrollChild ) ;
286298 ionic . on ( touchEndEvent , handleTouchend , scrollChild ) ;
287299 ionic . on ( 'mousedown' , handleMousedown , scrollChild ) ;
@@ -294,6 +306,7 @@ IonicModule
294306 } ;
295307
296308 function destroy ( ) {
309+ ionic . off ( touchStartEvent , handleTouchstart , scrollChild ) ;
297310 ionic . off ( touchMoveEvent , handleTouchmove , scrollChild ) ;
298311 ionic . off ( touchEndEvent , handleTouchend , scrollChild ) ;
299312 ionic . off ( 'mousedown' , handleMousedown , scrollChild ) ;
0 commit comments