From 1c789f8a88fbcc71fafdcf1ee20a58f625e6093a Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 7 Jul 2014 12:18:20 -0600 Subject: [PATCH] fix(scrollView): always stay exactly within boundaries after bounce Closes #1736 --- js/views/scrollView.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/views/scrollView.js b/js/views/scrollView.js index 4e67704dd2..fce8220d2a 100644 --- a/js/views/scrollView.js +++ b/js/views/scrollView.js @@ -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; };