Skip to content

Commit eed6b19

Browse files
committed
fix(scrollView): start scroll again if it stops beyond boundaries
Addresses #482
1 parent 79387a4 commit eed6b19

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Diff for: js/views/scrollView.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -2024,17 +2024,23 @@ ionic.views.Scroll = ionic.views.View.inherit({
20242024

20252025
// Slow down until slow enough, then flip back to snap position
20262026
if (scrollOutsideX !== 0) {
2027-
if (scrollOutsideX * self.__decelerationVelocityX <= self.__minDecelerationScrollLeft) {
2027+
var isHeadingOutwardsX = scrollOutsideX * self.__decelerationVelocityX <= self.__minDecelerationScrollLeft;
2028+
if (isHeadingOutwardsX) {
20282029
self.__decelerationVelocityX += scrollOutsideX * penetrationDeceleration;
2029-
} else {
2030+
}
2031+
//If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds
2032+
if (!isHeadingOutwardsX || self.__decelerationVelocityX <= self.__minDecelerationScrollLeft) {
20302033
self.__decelerationVelocityX = scrollOutsideX * penetrationAcceleration;
20312034
}
20322035
}
20332036

20342037
if (scrollOutsideY !== 0) {
2035-
if (scrollOutsideY * self.__decelerationVelocityY <= self.__minDecelerationScrollTop) {
2038+
var isHeadingOutwardsY = scrollOutsideY * self.__decelerationVelocityY <= self.__minDecelerationScrollTop;
2039+
if (isHeadingOutwardsY) {
20362040
self.__decelerationVelocityY += scrollOutsideY * penetrationDeceleration;
2037-
} else {
2041+
}
2042+
//If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds
2043+
if (!isHeadingOutwardsY || self.__decelerationVelocityY <= self.__minDecelerationScrollTop) {
20382044
self.__decelerationVelocityY = scrollOutsideY * penetrationAcceleration;
20392045
}
20402046
}

0 commit comments

Comments
 (0)