Skip to content

Commit

Permalink
fix(sideMenu): close menu w/ drag on Android 4.4
Browse files Browse the repository at this point in the history
Fixes #2102
  • Loading branch information
adamdbradley committed Aug 30, 2014
1 parent 98629d4 commit a49f374
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions js/angular/directive/sideMenuContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ function($timeout, $ionicGesture, $window) {
e.gesture.srcEvent.preventDefault();
startCoord = null;
primaryScrollAxis = null;
} else if(gestureEvt && gestureEvt.gesture && !startCoord) {
startCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);
}
}

Expand Down Expand Up @@ -113,7 +115,7 @@ function($timeout, $ionicGesture, $window) {
var xDistance = Math.abs(endCoord.x - startCoord.x);
var yDistance = Math.abs(endCoord.y - startCoord.y);

var scrollAxis = ( xDistance > yDistance ? 'x' : 'y' );
var scrollAxis = ( xDistance < yDistance ? 'y' : 'x' );

if( Math.max(xDistance, yDistance) > 30 ) {
// ok, we pretty much know which way they're going
Expand All @@ -123,8 +125,8 @@ function($timeout, $ionicGesture, $window) {

return scrollAxis;
}

}
return 'x';
}

var content = {
Expand Down Expand Up @@ -166,12 +168,12 @@ function($timeout, $ionicGesture, $window) {
sideMenuCtrl.setContent(content);

// add gesture handlers
var contentTapGesture = $ionicGesture.on('tap', onContentTap, $element);
var dragRightGesture = $ionicGesture.on('dragright', onDragX, $element);
var dragLeftGesture = $ionicGesture.on('dragleft', onDragX, $element);
var dragUpGesture = $ionicGesture.on('dragup', onDragY, $element);
var dragDownGesture = $ionicGesture.on('dragdown', onDragY, $element);
var releaseGesture = $ionicGesture.on('release', onDragRelease, $element);
var contentTapGesture = $ionicGesture.on('tap', onContentTap, $element);

// Cleanup
$scope.$on('$destroy', function() {
Expand Down

0 comments on commit a49f374

Please sign in to comment.