Fixed #366 - no Android scroll bouncing by default

This commit is contained in:
Max Lynch
2014-01-10 09:52:32 -06:00
parent c0cee27747
commit cb75c9de96
8 changed files with 66 additions and 11 deletions

View File

@@ -18,7 +18,7 @@ angular.module('ionic.ui.content', ['ionic.ui.service'])
// The content directive is a core scrollable content area
// that is part of many View hierarchies
.directive('content', ['$parse', '$timeout', 'ScrollDelegate', function($parse, $timeout, ScrollDelegate) {
.directive('content', ['$parse', '$timeout', 'Platform', 'ScrollDelegate', function($parse, $timeout, Platform, ScrollDelegate) {
return {
restrict: 'E',
replace: true,
@@ -32,6 +32,7 @@ angular.module('ionic.ui.content', ['ionic.ui.service'])
refreshComplete: '=',
onInfiniteScroll: '=',
infiniteScrollDistance: '@',
hasBouncing: '@',
scroll: '@',
hasScrollX: '@',
hasScrollY: '@',
@@ -87,8 +88,13 @@ angular.module('ionic.ui.content', ['ionic.ui.service'])
// Otherwise, supercharge this baby!
$timeout(function() {
var hasBouncing = $scope.$eval($scope.hasBouncing);
var enableBouncing = !Platform.is('Android') && hasBouncing !== false;
// No bouncing by default for Android users, lest they take up pitchforks
// to our bouncing goodness
sv = new ionic.views.Scroll({
el: $element[0],
bouncing: enableBouncing,
scrollbarX: $scope.$eval($scope.scrollbarX) !== false,
scrollbarY: $scope.$eval($scope.scrollbarY) !== false,
scrollingX: $scope.$eval($scope.hasScrollX) === true,

View File

@@ -66,6 +66,10 @@ angular.module('ionic.service.platform', [])
});
},
is: function(type) {
return ionic.Platform.is(type);
},
/**
* Trigger a callback once the device is ready, or immediately if the device is already
* ready.