Bug 713729 - Ensure that a fling is in progress when doing velocity-based fling adjustments. r=pcwalton
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 29 Dec 2011 22:29:16 -0500
changeset 84791 bcfe95e5f7bd169a6745e4064dafbf583319b350
parent 84790 d0e07813ae6ee422b1f42c5f576bc48b2e8d380b
child 84792 6e4452ca6da267b562ba688ef5d2d2007299d298
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspcwalton
bugs713729
milestone12.0a1
Bug 713729 - Ensure that a fling is in progress when doing velocity-based fling adjustments. r=pcwalton
mobile/android/base/ui/PanZoomController.java
--- a/mobile/android/base/ui/PanZoomController.java
+++ b/mobile/android/base/ui/PanZoomController.java
@@ -664,30 +664,30 @@ public class PanZoomController
                 mX.advanceFling();
             if (flingingY)
                 mY.advanceFling();
 
             /* If we're still flinging in any direction, update the origin. */
             if (flingingX || flingingY) {
                 mX.displace(); mY.displace();
                 updatePosition();
+
+                /*
+                 * If we're still flinging with an appreciable velocity, stop here. The threshold is
+                 * higher in the case of overscroll, so we bounce back eagerly when overscrolling but
+                 * coast smoothly to a stop when not.
+                 */
+                float excess = PointUtils.distance(new PointF(mX.getExcess(), mY.getExcess()));
+                PointF velocityVector = new PointF(mX.getRealVelocity(), mY.getRealVelocity());
+                float threshold = (excess >= 1.0f) ? STOPPED_THRESHOLD : FLING_STOPPED_THRESHOLD;
+                if (PointUtils.distance(velocityVector) >= threshold)
+                    return;
             }
 
             /*
-             * If we're still flinging with an appreciable velocity, stop here. The threshold is
-             * higher in the case of overscroll, so we bounce back eagerly when overscrolling but
-             * coast smoothly to a stop when not.
-             */
-            float excess = PointUtils.distance(new PointF(mX.getExcess(), mY.getExcess()));
-            PointF velocityVector = new PointF(mX.getRealVelocity(), mY.getRealVelocity());
-            float threshold = (excess >= 1.0f) ? STOPPED_THRESHOLD : FLING_STOPPED_THRESHOLD;
-            if (PointUtils.distance(velocityVector) >= threshold)
-                return;
-
-            /*
              * Perform a bounce-back animation if overscrolled, unless panning is being overridden
              * (which happens e.g. when the user is panning an iframe).
              */
             boolean overscrolledX = mX.getOverscroll() != Axis.Overscroll.NONE;
             boolean overscrolledY = mY.getOverscroll() != Axis.Overscroll.NONE;
             if (!mOverridePanning && (overscrolledX || overscrolledY)) {
                 bounce();
             } else {