fix(scrollView): start scroll again if it stops beyond boundaries

Addresses #482
This commit is contained in:
Andy Joslin
2014-02-11 14:38:02 -05:00
parent 79387a4e4a
commit eed6b19b51

View File

@@ -2024,17 +2024,23 @@ ionic.views.Scroll = ionic.views.View.inherit({
// Slow down until slow enough, then flip back to snap position
if (scrollOutsideX !== 0) {
if (scrollOutsideX * self.__decelerationVelocityX <= self.__minDecelerationScrollLeft) {
var isHeadingOutwardsX = scrollOutsideX * self.__decelerationVelocityX <= self.__minDecelerationScrollLeft;
if (isHeadingOutwardsX) {
self.__decelerationVelocityX += scrollOutsideX * penetrationDeceleration;
} else {
}
//If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds
if (!isHeadingOutwardsX || self.__decelerationVelocityX <= self.__minDecelerationScrollLeft) {
self.__decelerationVelocityX = scrollOutsideX * penetrationAcceleration;
}
}
if (scrollOutsideY !== 0) {
if (scrollOutsideY * self.__decelerationVelocityY <= self.__minDecelerationScrollTop) {
var isHeadingOutwardsY = scrollOutsideY * self.__decelerationVelocityY <= self.__minDecelerationScrollTop;
if (isHeadingOutwardsY) {
self.__decelerationVelocityY += scrollOutsideY * penetrationDeceleration;
} else {
}
//If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds
if (!isHeadingOutwardsY || self.__decelerationVelocityY <= self.__minDecelerationScrollTop) {
self.__decelerationVelocityY = scrollOutsideY * penetrationAcceleration;
}
}