private void startPanning(float x, float y, long time) {
    float dx = mX.panDistance(x);
    float dy = mY.panDistance(y);
    double angle = Math.atan2(dy, dx); // range [-pi, pi]
    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 (!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);
    }
  }
 private void startTouch(float x, float y, long time) {
   mX.startTouch(x);
   mY.startTouch(y);
   setState(PanZoomState.TOUCHING);
   mLastEventTime = time;
 }