Bug 1175564 - don't lock y-axis if pan displacement is 0. r=kats
authorPaul Rouget <paul@mozilla.com>
Fri, 19 Jun 2015 08:37:00 +0200
changeset 249907 738e3dcf5eed00cf3a64672258f51876c11e7a34
parent 249906 8ce4a0a6691b52da2fc37275f159e3d79551092f
child 249908 92ce2f6910196ae01353c828f1849d9bf4d0a8fa
push id61390
push usercbook@mozilla.com
push dateMon, 22 Jun 2015 08:33:06 +0000
treeherdermozilla-inbound@738e3dcf5eed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1175564
milestone41.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 1175564 - don't lock y-axis if pan displacement is 0. r=kats
gfx/layers/apz/src/AsyncPanZoomController.cpp
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1634,20 +1634,24 @@ nsEventStatus AsyncPanZoomController::On
   mY.StartTouch(aEvent.mLocalPanStartPoint.y, aEvent.mTime);
 
   if (GetAxisLockMode() == FREE) {
     SetState(PANNING);
     return nsEventStatus_eConsumeNoDefault;
   }
 
   float dx = aEvent.mPanDisplacement.x, dy = aEvent.mPanDisplacement.y;
-  double angle = atan2(dy, dx); // range [-pi, pi]
-  angle = fabs(angle); // range [0, pi]
-
-  HandlePanning(angle);
+
+  if (dx || dy) {
+    double angle = atan2(dy, dx); // range [-pi, pi]
+    angle = fabs(angle); // range [0, pi]
+    HandlePanning(angle);
+  } else {
+    SetState(PANNING);
+  }
 
   return nsEventStatus_eConsumeNoDefault;
 }
 
 nsEventStatus AsyncPanZoomController::OnPan(const PanGestureInput& aEvent, ScrollSource aSource, bool aFingersOnTouchpad) {
   APZC_LOG("%p got a pan-pan in state %d\n", this, mState);
 
   if (mState == SMOOTH_SCROLL) {