Bug 769391 - Prevent axis locking when on a page that fits the user's screen vertically or horizontally. r=kats
authorAlexHagerman <alex.hagerman@gmail.com>
Mon, 17 Sep 2012 10:55:58 -0400
changeset 107229 cf303be47402657cf5dbadef5b33636624e14516
parent 107228 5bfe70eff7791f337c1e8c991d8e0b9c5aa8363f
child 107230 f4a470dfb0b2c4e6542940b76b1b3830497a1ff6
push id14921
push userkgupta@mozilla.com
push dateMon, 17 Sep 2012 14:57:14 +0000
treeherdermozilla-inbound@cf303be47402 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs769391
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 769391 - Prevent axis locking when on a page that fits the user's screen vertically or horizontally. r=kats
mobile/android/base/ui/Axis.java
mobile/android/base/ui/PanZoomController.java
--- a/mobile/android/base/ui/Axis.java
+++ b/mobile/android/base/ui/Axis.java
@@ -207,17 +207,17 @@ abstract class Axis {
         default:        return 0.0f;
         }
     }
 
     /*
      * Returns true if the page is zoomed in to some degree along this axis such that scrolling is
      * possible and this axis has not been scroll locked while panning. Otherwise, returns false.
      */
-    private boolean scrollable() {
+    boolean scrollable() {
         // If we're scrolling a subdocument, ignore the viewport length restrictions (since those
         // apply to the top-level document) and only take into account axis locking.
         if (mSubscroller.scrolling()) {
             return !mScrollingDisabled;
         }
 
         // if we are axis locked, return false
         if (mScrollingDisabled) {
--- a/mobile/android/base/ui/PanZoomController.java
+++ b/mobile/android/base/ui/PanZoomController.java
@@ -488,17 +488,19 @@ public class PanZoomController
         angle = Math.abs(angle); // range [0, pi]
 
         // When the touch move breaks through the pan threshold, reposition the touch down origin
         // so the page won't jump when we start panning.
         mX.startTouch(x);
         mY.startTouch(y);
         mLastEventTime = time;
 
-        if (angle < AXIS_LOCK_ANGLE || angle > (Math.PI - AXIS_LOCK_ANGLE)) {
+        if (!mX.scrollable() || !mY.scrollable()) {
+            setState(PanZoomState.PANNING);
+        } else if (angle < AXIS_LOCK_ANGLE || angle > (Math.PI - AXIS_LOCK_ANGLE)) {
             mY.setScrollingDisabled(true);
             setState(PanZoomState.PANNING_LOCKED);
         } else if (Math.abs(angle - (Math.PI / 2)) < AXIS_LOCK_ANGLE) {
             mX.setScrollingDisabled(true);
             setState(PanZoomState.PANNING_LOCKED);
         } else {
             setState(PanZoomState.PANNING);
         }