зеркало из https://github.com/mozilla/gecko-dev.git
Bug 804949: Change the way panning works. r=cjones a=blocking-basecamp
This commit is contained in:
Родитель
cd35ecb8fa
Коммит
652bd75bad
|
@ -46,11 +46,6 @@ static const int32_t FLING_REPAINT_INTERVAL = 75;
|
|||
*/
|
||||
static const float MIN_SKATE_SPEED = 0.7f;
|
||||
|
||||
/**
|
||||
* Angle from axis within which we stay axis-locked.
|
||||
*/
|
||||
static const float AXIS_LOCK_ANGLE = M_PI / 9.0;
|
||||
|
||||
/**
|
||||
* Duration of a zoom to animation.
|
||||
*/
|
||||
|
@ -610,12 +605,6 @@ void AsyncPanZoomController::StartPanning(const MultiTouchInput& aEvent) {
|
|||
angle = fabs(angle); // range [0, pi]
|
||||
|
||||
SetState(PANNING);
|
||||
|
||||
if (angle < AXIS_LOCK_ANGLE || angle > (M_PI - AXIS_LOCK_ANGLE)) {
|
||||
mY.LockPanning();
|
||||
} else if (fabsf(angle - M_PI / 2) < AXIS_LOCK_ANGLE) {
|
||||
mX.LockPanning();
|
||||
}
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::UpdateWithTouchAtDevicePoint(const MultiTouchInput& aEvent) {
|
||||
|
|
|
@ -364,8 +364,8 @@ protected:
|
|||
SingleTouchData& GetFirstSingleTouch(const MultiTouchInput& aEvent);
|
||||
|
||||
/**
|
||||
* Sets up anything needed for panning. This may lock one of the axes if the
|
||||
* angle of movement is heavily skewed towards it.
|
||||
* Sets up anything needed for panning. This takes us out of the "TOUCHING"
|
||||
* state and starts actually panning us.
|
||||
*/
|
||||
void StartPanning(const MultiTouchInput& aStartPoint);
|
||||
|
||||
|
@ -442,7 +442,7 @@ private:
|
|||
NOTHING, /* no touch-start events received */
|
||||
FLING, /* all touches removed, but we're still scrolling page */
|
||||
TOUCHING, /* one touch-start event received */
|
||||
PANNING, /* panning without axis lock */
|
||||
PANNING, /* panning the frame */
|
||||
PINCHING, /* nth touch-start, where n > 1. this mode allows pan and zoom */
|
||||
ANIMATING_ZOOM, /* animated zoom to a new rect */
|
||||
WAITING_LISTENERS, /* a state halfway between NOTHING and TOUCHING - the user has
|
||||
|
|
|
@ -52,17 +52,12 @@ Axis::Axis(AsyncPanZoomController* aAsyncPanZoomController)
|
|||
: mPos(0.0f),
|
||||
mVelocity(0.0f),
|
||||
mAcceleration(0),
|
||||
mAsyncPanZoomController(aAsyncPanZoomController),
|
||||
mLockPanning(false)
|
||||
mAsyncPanZoomController(aAsyncPanZoomController)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Axis::UpdateWithTouchAtDevicePoint(int32_t aPos, const TimeDuration& aTimeDelta) {
|
||||
if (mLockPanning) {
|
||||
return;
|
||||
}
|
||||
|
||||
float newVelocity = (mPos - aPos) / aTimeDelta.ToMilliseconds();
|
||||
|
||||
bool curVelocityIsLow = fabsf(newVelocity) < 0.01f;
|
||||
|
@ -91,7 +86,6 @@ void Axis::UpdateWithTouchAtDevicePoint(int32_t aPos, const TimeDuration& aTimeD
|
|||
void Axis::StartTouch(int32_t aPos) {
|
||||
mStartPos = aPos;
|
||||
mPos = aPos;
|
||||
mLockPanning = false;
|
||||
}
|
||||
|
||||
float Axis::GetDisplacementForDuration(float aScale, const TimeDuration& aDelta) {
|
||||
|
@ -126,10 +120,6 @@ void Axis::CancelTouch() {
|
|||
mAcceleration = 0;
|
||||
}
|
||||
|
||||
void Axis::LockPanning() {
|
||||
mLockPanning = true;
|
||||
}
|
||||
|
||||
bool Axis::FlingApplyFrictionOrCancel(const TimeDuration& aDelta) {
|
||||
if (fabsf(mVelocity) <= FLING_STOPPED_THRESHOLD) {
|
||||
// If the velocity is very low, just set it to 0 and stop the fling,
|
||||
|
|
|
@ -66,14 +66,6 @@ public:
|
|||
*/
|
||||
void CancelTouch();
|
||||
|
||||
/**
|
||||
* Sets axis locking. This prevents any panning along this axis. If the
|
||||
* current touch point is updated and the axis is locked, the velocity will
|
||||
* not be recalculated. Any already-existing velocity will however stay the
|
||||
* same.
|
||||
*/
|
||||
void LockPanning();
|
||||
|
||||
/**
|
||||
* Gets displacement that should have happened since the previous touch.
|
||||
* Note: Does not reset the displacement. It gets recalculated on the next
|
||||
|
@ -192,7 +184,6 @@ protected:
|
|||
// reach one of the extremes of the page.
|
||||
int32_t mAcceleration;
|
||||
nsRefPtr<AsyncPanZoomController> mAsyncPanZoomController;
|
||||
bool mLockPanning;
|
||||
};
|
||||
|
||||
class AxisX : public Axis {
|
||||
|
|
Загрузка…
Ссылка в новой задаче