@@ -169,7 +169,7 @@ function MdGesture($$MdGestureHandler, $$rAF, $timeout) {
169
169
* Register handlers. These listen to touch/start/move events, interpret them,
170
170
* and dispatch gesture events depending on options & conditions. These are all
171
171
* instances of GestureHandler.
172
- * @see GestureHandler
172
+ * @see GestureHandler
173
173
*/
174
174
return self
175
175
/*
@@ -305,15 +305,18 @@ function MdGesture($$MdGestureHandler, $$rAF, $timeout) {
305
305
onEnd : function ( ev , pointer ) {
306
306
var eventType ;
307
307
308
- if ( Math . abs ( pointer . velocityX ) > this . state . options . minVelocity &&
309
- Math . abs ( pointer . distanceX ) > this . state . options . minDistance ) {
310
- eventType = pointer . directionX == 'left' ? '$md.swipeleft' : '$md.swiperight' ;
311
- this . dispatchEvent ( ev , eventType ) ;
312
- }
313
- else if ( Math . abs ( pointer . velocityY ) > this . state . options . minVelocity &&
314
- Math . abs ( pointer . distanceY ) > this . state . options . minDistance ) {
315
- eventType = pointer . directionY == 'up' ? '$md.swipeup' : '$md.swipedown' ;
316
- this . dispatchEvent ( ev , eventType ) ;
308
+ if ( Math . abs ( pointer . distanceX ) > Math . abs ( pointer . distanceY ) ) {
309
+ if ( Math . abs ( pointer . velocityX ) > this . state . options . minVelocity &&
310
+ Math . abs ( pointer . distanceX ) > this . state . options . minDistance ) {
311
+ eventType = pointer . directionX == 'left' ? '$md.swipeleft' : '$md.swiperight' ;
312
+ this . dispatchEvent ( ev , eventType ) ;
313
+ }
314
+ } else {
315
+ if ( Math . abs ( pointer . velocityY ) > this . state . options . minVelocity &&
316
+ Math . abs ( pointer . distanceY ) > this . state . options . minDistance ) {
317
+ eventType = pointer . directionY == 'up' ? '$md.swipeup' : '$md.swipedown' ;
318
+ this . dispatchEvent ( ev , eventType ) ;
319
+ }
317
320
}
318
321
}
319
322
} ) ;
@@ -496,7 +499,7 @@ function attachToDocument( $mdGesture, $$MdGestureHandler ) {
496
499
* click event will be sent ~400ms after a touchend event happens.
497
500
* The only way to know if this click is real is to prevent any normal
498
501
* click events, and add a flag to events sent by material so we know not to prevent those.
499
- *
502
+ *
500
503
* Two exceptions to click events that should be prevented are:
501
504
* - click events sent by the keyboard (eg form submit)
502
505
* - events that originate from an Ionic app
0 commit comments