Skip to content

Commit

Permalink
fix(scrollView): start scroll again if it stops beyond boundaries
Browse files Browse the repository at this point in the history
Addresses #482
  • Loading branch information
ajoslin committed Feb 11, 2014
1 parent 79387a4 commit eed6b19
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions js/views/scrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit eed6b19

Please sign in to comment.