Bug 1193062 - Process pan gesture deltas in begin+end events. r=kats
We don't want to split native NSEvents into two PanGestureInput events.
This commit is contained in:
@@ -1673,6 +1673,9 @@ nsEventStatus AsyncPanZoomController::OnPanBegin(const PanGestureInput& aEvent)
|
||||
SetState(PANNING);
|
||||
}
|
||||
|
||||
// Call into OnPan in order to process any delta included in this event.
|
||||
OnPan(aEvent, true);
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
@@ -1680,17 +1683,29 @@ nsEventStatus AsyncPanZoomController::OnPan(const PanGestureInput& aEvent, bool
|
||||
APZC_LOG("%p got a pan-pan in state %d\n", this, mState);
|
||||
|
||||
if (mState == SMOOTH_SCROLL) {
|
||||
if (aEvent.mType == PanGestureInput::PANGESTURE_MOMENTUMPAN) {
|
||||
if (!aFingersOnTouchpad) {
|
||||
// When a SMOOTH_SCROLL scroll is being processed on a frame, mouse
|
||||
// wheel and trackpad momentum scroll position updates will not cancel the
|
||||
// SMOOTH_SCROLL scroll animations, enabling scripts that depend on
|
||||
// them to be responsive without forcing the user to wait for the momentum
|
||||
// scrolling to completely stop.
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
} else {
|
||||
}
|
||||
|
||||
// SMOOTH_SCROLL scrolls are cancelled by pan gestures.
|
||||
CancelAnimation();
|
||||
}
|
||||
|
||||
if (mState == NOTHING) {
|
||||
// This event block was interrupted by something else. If the user's fingers
|
||||
// are still on on the touchpad we want to resume scrolling, otherwise we
|
||||
// ignore the rest of the scroll gesture.
|
||||
if (!aFingersOnTouchpad) {
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
// Resume / restart the pan.
|
||||
// PanBegin will call back into this function with mState == PANNING.
|
||||
return OnPanBegin(aEvent);
|
||||
}
|
||||
|
||||
// We need to update the axis velocity in order to get a useful display port
|
||||
@@ -1717,6 +1732,9 @@ nsEventStatus AsyncPanZoomController::OnPan(const PanGestureInput& aEvent, bool
|
||||
nsEventStatus AsyncPanZoomController::OnPanEnd(const PanGestureInput& aEvent) {
|
||||
APZC_LOG("%p got a pan-end in state %d\n", this, mState);
|
||||
|
||||
// Call into OnPan in order to process any delta included in this event.
|
||||
OnPan(aEvent, true);
|
||||
|
||||
mX.EndTouch(aEvent.mTime);
|
||||
mY.EndTouch(aEvent.mTime);
|
||||
SetState(NOTHING);
|
||||
@@ -1735,12 +1753,17 @@ nsEventStatus AsyncPanZoomController::OnPanMomentumStart(const PanGestureInput&
|
||||
|
||||
SetState(PAN_MOMENTUM);
|
||||
|
||||
// Call into OnPan in order to process any delta included in this event.
|
||||
OnPan(aEvent, false);
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
nsEventStatus AsyncPanZoomController::OnPanMomentumEnd(const PanGestureInput& aEvent) {
|
||||
APZC_LOG("%p got a pan-momentumend in state %d\n", this, mState);
|
||||
|
||||
// Call into OnPan in order to process any delta included in this event.
|
||||
OnPan(aEvent, false);
|
||||
|
||||
// We need to reset the velocity to zero. We don't really have a "touch"
|
||||
// here because the touch has already ended long before the momentum
|
||||
|
||||
@@ -322,7 +322,7 @@ public:
|
||||
PanGestureType mType;
|
||||
ScreenPoint mPanStartPoint;
|
||||
|
||||
// Only non-zero if mType is PANGESTURE_PAN or PANGESTURE_MOMENTUMPAN.
|
||||
// The delta. This can be non-zero on any type of event.
|
||||
ScreenPoint mPanDisplacement;
|
||||
|
||||
// Versions of |mPanStartPoint| and |mPanDisplacement| in the local
|
||||
|
||||
Reference in New Issue
Block a user