diff --git a/js/views/scrollView.js b/js/views/scrollView.js index eb9d21b409..0dc551253c 100644 --- a/js/views/scrollView.js +++ b/js/views/scrollView.js @@ -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; } }