Merge branch 'master' of github.com:driftyco/ionic

This commit is contained in:
perry
2015-02-13 11:51:16 -06:00
2 changed files with 21 additions and 2 deletions

View File

@@ -162,7 +162,7 @@ function($scope,
self.freezeAllScrolls = function(shouldFreeze) {
for (var i = 0; i < $ionicScrollDelegate._instances.length; i++) {
$ionicScrollDelegate._instances[x].freezeScroll(shouldFreeze);
$ionicScrollDelegate._instances[i].freezeScroll(shouldFreeze);
}
};

View File

@@ -6,7 +6,8 @@ IonicModule
'$ionicPlatform',
'$ionicBody',
'$ionicHistory',
function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $ionicHistory) {
'$ionicScrollDelegate',
function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $ionicHistory, $ionicScrollDelegate) {
var self = this;
var rightShowing, leftShowing, isDragging;
var startX, lastX, offsetX, isAsideExposed;
@@ -148,8 +149,20 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
// add the CSS class "menu-open" if the percentage does not
// equal 0, otherwise remove the class from the body element
$ionicBody.enableClass((percentage !== 0), 'menu-open');
freezeAllScrolls(false);
};
function freezeAllScrolls(shouldFreeze) {
if (shouldFreeze && !self.isScrollFreeze) {
$ionicScrollDelegate.freezeAllScrolls(shouldFreeze);
} else if (!shouldFreeze && self.isScrollFreeze) {
$ionicScrollDelegate.freezeAllScrolls(false);
}
self.isScrollFreeze = shouldFreeze;
}
/**
* Open the menu the given pixel amount.
* @param {float} amount the pixel amount to open the menu. Positive value for left menu,
@@ -297,6 +310,8 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
// End a drag with the given event
self._endDrag = function(e) {
freezeAllScrolls(false);
if (isAsideExposed) return;
if (isDragging) {
@@ -334,6 +349,7 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
if (isDragging) {
self.openAmount(offsetX + (lastX - startX));
freezeAllScrolls(true);
}
};
@@ -415,6 +431,9 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
self.content.element = null;
self.content = null;
}
// ensure scrolls are unfrozen
freezeAllScrolls(false);
});
self.initialize({