From 63b0a319700bcd3229fa95da7306003c6476decd Mon Sep 17 00:00:00 2001 From: Andy Joslin Date: Wed, 12 Feb 2014 07:35:08 -0500 Subject: [PATCH] refactor(scrollView): restart scroll if stopped, + or - Addresses #482 --- js/views/scrollView.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/views/scrollView.js b/js/views/scrollView.js index 0dc551253c..446675ae25 100644 --- a/js/views/scrollView.js +++ b/js/views/scrollView.js @@ -2028,8 +2028,9 @@ ionic.views.Scroll = ionic.views.View.inherit({ if (isHeadingOutwardsX) { self.__decelerationVelocityX += scrollOutsideX * penetrationDeceleration; } + var isStoppedX = Math.abs(self.__decelerationVelocityX) <= self.__minDecelerationScrollLeft; //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) { + if (!isHeadingOutwardsX || isStoppedX) { self.__decelerationVelocityX = scrollOutsideX * penetrationAcceleration; } } @@ -2039,8 +2040,9 @@ ionic.views.Scroll = ionic.views.View.inherit({ if (isHeadingOutwardsY) { self.__decelerationVelocityY += scrollOutsideY * penetrationDeceleration; } + var isStoppedY = Math.abs(self.__decelerationVelocityY) <= self.__minDecelerationScrollTop; //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) { + if (!isHeadingOutwardsY || isStoppedY) { self.__decelerationVelocityY = scrollOutsideY * penetrationAcceleration; } }