From c87aa9f1350fedd1f258e4e98607fd7d562deb9c Mon Sep 17 00:00:00 2001 From: Julian Garnier Date: Mon, 26 May 2014 23:37:22 +0200 Subject: [PATCH 1/2] Let the user stop and hold the page during a bounce Fix a bug where the page abruptly jumps to the top or bottom if a user try to stop the scrolling animation and hold the page at his current position during a bounce. --- src/Scroller.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Scroller.js b/src/Scroller.js index 9901be7..248df88 100644 --- a/src/Scroller.js +++ b/src/Scroller.js @@ -66,7 +66,7 @@ var Scroller; provided that another scrolling action has not begun. Used to know when to fade out a scrollbar. */ scrollingComplete: NOOP, - + /** This configures the amount of change applied to deceleration when reaching boundaries **/ penetrationDeceleration : 0.03, @@ -595,7 +595,9 @@ var Scroller; } // Publish new values - self.__publish(left, top, zoom, animate); + if (!self.__isTracking) { + self.__publish(left, top, zoom, animate); + } }, @@ -1307,8 +1309,8 @@ var Scroller; var scrollOutsideY = 0; // This configures the amount of change applied to deceleration/acceleration when reaching boundaries - var penetrationDeceleration = self.options.penetrationDeceleration; - var penetrationAcceleration = self.options.penetrationAcceleration; + var penetrationDeceleration = self.options.penetrationDeceleration; + var penetrationAcceleration = self.options.penetrationAcceleration; // Check limits if (scrollLeft < self.__minDecelerationScrollLeft) { From 9c66390b4b2123e73cbc2ca11e106eb1163f1617 Mon Sep 17 00:00:00 2001 From: Julian Garnier Date: Sat, 7 Jun 2014 14:31:05 +0200 Subject: [PATCH 2/2] fix the abrupt scrollTo 0 with small velocity --- src/Scroller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Scroller.js b/src/Scroller.js index 248df88..97ff28e 100644 --- a/src/Scroller.js +++ b/src/Scroller.js @@ -1197,7 +1197,7 @@ var Scroller; }; // How much velocity is required to keep the deceleration running - var minVelocityToKeepDecelerating = self.options.snapping ? 4 : 0.1; + var minVelocityToKeepDecelerating = self.options.snapping ? 4 : 0.001; // Detect whether it's still worth to continue animating steps // If we are already slow enough to not being user perceivable anymore, we stop the whole process here.