nsEventStatus AsyncPanZoomController::OnTouchMove(const MultiTouchEvent& event) { SingleTouchData& touch = GetTouchFromEvent(event); nsIntPoint point = touch.mScreenPoint; PRInt32 xPos = point.x, yPos = point.y; switch (mState) { case FLING: case BOUNCE: case WAITING_LISTENERS: // Should never happen. NS_WARNING("Received impossible touch in OnTouchMove"); // Fall through. case ANIMATED_ZOOM: case NOTHING: // May happen if the user double-taps and drags without lifting after the // second tap. Ignore the move if this happens. return nsEventStatus_eIgnore; case TOUCHING: if (PanDistance(event) < mPanThreshold) { return nsEventStatus_eIgnore; } mLastRepaint = event.mTime; mX.StartTouch(xPos); mY.StartTouch(yPos); mState = PANNING; return nsEventStatus_eConsumeNoDefault; case PANNING_HOLD_LOCKED: mState = PANNING_LOCKED; // Fall through. case PANNING_LOCKED: TrackTouch(event); return nsEventStatus_eConsumeNoDefault; case PANNING_HOLD: mState = PANNING; // Fall through. case PANNING: TrackTouch(event); return nsEventStatus_eConsumeNoDefault; case PINCHING: // The scale gesture listener should have handled this. NS_WARNING("Gesture listener should have handled pinching in OnTouchMove."); return nsEventStatus_eIgnore; } return nsEventStatus_eConsumeNoDefault; }
nsEventStatus AsyncPanZoomController::OnTouchMove(const MultiTouchInput& aEvent) { switch (mState) { case FLING: case NOTHING: // May happen if the user double-taps and drags without lifting after the // second tap. Ignore the move if this happens. return nsEventStatus_eIgnore; case TOUCHING: { float panThreshold = 1.0f/2.0f * mDPI; UpdateWithTouchAtDevicePoint(aEvent); if (PanDistance() < panThreshold) { return nsEventStatus_eIgnore; } StartPanning(aEvent); return nsEventStatus_eConsumeNoDefault; } case PANNING: TrackTouch(aEvent); return nsEventStatus_eConsumeNoDefault; case PINCHING: // The scale gesture listener should have handled this. NS_WARNING("Gesture listener should have handled pinching in OnTouchMove."); return nsEventStatus_eIgnore; } return nsEventStatus_eConsumeNoDefault; }