Skip to content

Commit 1aef593

Browse files
committed
fix(scrollView): do not stop scrolling if stopped beyond boundaries
Addresses #482
1 parent 68ffe8b commit 1aef593

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

js/views/scrollView.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1911,12 +1911,13 @@ ionic.views.Scroll = ionic.views.View.inherit({
19111911
};
19121912

19131913
// How much velocity is required to keep the deceleration running
1914-
var minVelocityToKeepDecelerating = self.options.snapping ? 4 : 0.1;
1914+
self.__minVelocityToKeepDecelerating = self.options.snapping ? 4 : 0.1;
19151915

19161916
// Detect whether it's still worth to continue animating steps
19171917
// If we are already slow enough to not being user perceivable anymore, we stop the whole process here.
19181918
var verify = function() {
1919-
var shouldContinue = Math.abs(self.__decelerationVelocityX) >= minVelocityToKeepDecelerating || Math.abs(self.__decelerationVelocityY) >= minVelocityToKeepDecelerating;
1919+
var shouldContinue = Math.abs(self.__decelerationVelocityX) >= self.__minVelocityToKeepDecelerating ||
1920+
Math.abs(self.__decelerationVelocityY) >= self.__minVelocityToKeepDecelerating;
19201921
if (!shouldContinue) {
19211922
self.__didDecelerationComplete = true;
19221923
}
@@ -2047,7 +2048,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
20472048
if (isHeadingOutwardsX) {
20482049
self.__decelerationVelocityX += scrollOutsideX * penetrationDeceleration;
20492050
}
2050-
var isStoppedX = Math.abs(self.__decelerationVelocityX) <= self.__minDecelerationScrollLeft;
2051+
var isStoppedX = Math.abs(self.__decelerationVelocityX) <= self.__minVelocityToKeepDecelerating;
20512052
//If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds
20522053
if (!isHeadingOutwardsX || isStoppedX) {
20532054
self.__decelerationVelocityX = scrollOutsideX * penetrationAcceleration;
@@ -2059,7 +2060,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
20592060
if (isHeadingOutwardsY) {
20602061
self.__decelerationVelocityY += scrollOutsideY * penetrationDeceleration;
20612062
}
2062-
var isStoppedY = Math.abs(self.__decelerationVelocityY) <= self.__minDecelerationScrollTop;
2063+
var isStoppedY = Math.abs(self.__decelerationVelocityY) <= self.__minVelocityToKeepDecelerating;
20632064
//If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds
20642065
if (!isHeadingOutwardsY || isStoppedY) {
20652066
self.__decelerationVelocityY = scrollOutsideY * penetrationAcceleration;

0 commit comments

Comments
 (0)