Skip to content

Commit

Permalink
fix(scrollView): always stay exactly within boundaries after bounce
Browse files Browse the repository at this point in the history
Closes #1736
  • Loading branch information
ajoslin committed Jul 7, 2014
1 parent d5d38bb commit 1c789f8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions js/views/scrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -2118,6 +2118,16 @@ ionic.views.Scroll = ionic.views.View.inherit({
Math.abs(self.__decelerationVelocityY) >= self.__minVelocityToKeepDecelerating;
if (!shouldContinue) {
self.__didDecelerationComplete = true;

//Make sure the scroll values are within the boundaries after a bounce,
//not below 0 or above maximum
if (self.options.bouncing) {
self.scrollTo(
Math.min( Math.max(self.__scrollLeft, 0), self.__maxScrollLeft ),
Math.min( Math.max(self.__scrollTop, 0), self.__maxScrollTop ),
false
);
}
}
return shouldContinue;
};
Expand Down

0 comments on commit 1c789f8

Please sign in to comment.