Bug 962243 - Implement PINCH to TOUCHING transition in APZC. r=botond

--HG--
extra : commitid : FoHvf2KH9rd
This commit is contained in:
Dmitry Rozhkov 2015-11-22 08:57:45 -05:00
Родитель 201e5d02a4
Коммит 8df43f8eae
3 изменённых файлов: 25 добавлений и 1 удалений

Просмотреть файл

@ -1548,6 +1548,14 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(const PinchGestureInput& aEvent
UpdateSharedCompositorFrameMetrics(); UpdateSharedCompositorFrameMetrics();
} }
// Non-negative focus point would indicate that one finger is still down
if (aEvent.mFocusPoint.x != -1 && aEvent.mFocusPoint.y != -1) {
mPanDirRestricted = false;
mX.StartTouch(aEvent.mFocusPoint.x, aEvent.mTime);
mY.StartTouch(aEvent.mFocusPoint.y, aEvent.mTime);
SetState(TOUCHING);
}
return nsEventStatus_eConsumeNoDefault; return nsEventStatus_eConsumeNoDefault;
} }

Просмотреть файл

@ -101,6 +101,13 @@ nsEventStatus GestureEventListener::HandleInputEvent(const MultiTouchInput& aEve
} }
break; break;
case MultiTouchInput::MULTITOUCH_MOVE: case MultiTouchInput::MULTITOUCH_MOVE:
for (size_t i = 0; i < aEvent.mTouches.Length(); i++) {
for (size_t j = 0; j < mTouches.Length(); j++) {
if (aEvent.mTouches[i].mIdentifier == mTouches[j].mIdentifier) {
mTouches[j].mScreenPoint = aEvent.mTouches[i].mScreenPoint;
}
}
}
rv = HandleInputTouchMove(); rv = HandleInputTouchMove();
break; break;
case MultiTouchInput::MULTITOUCH_END: case MultiTouchInput::MULTITOUCH_END:
@ -375,10 +382,16 @@ nsEventStatus GestureEventListener::HandleInputTouchEnd()
case GESTURE_PINCH: case GESTURE_PINCH:
if (mTouches.Length() < 2) { if (mTouches.Length() < 2) {
SetState(GESTURE_NONE); SetState(GESTURE_NONE);
ScreenPoint point(-1, -1);
if (mTouches.Length() == 1) {
// As user still keeps one finger down the event's focus point should
// contain meaningful data.
point = mTouches[0].mScreenPoint;
}
PinchGestureInput pinchEvent(PinchGestureInput::PINCHGESTURE_END, PinchGestureInput pinchEvent(PinchGestureInput::PINCHGESTURE_END,
mLastTouchInput.mTime, mLastTouchInput.mTime,
mLastTouchInput.mTimeStamp, mLastTouchInput.mTimeStamp,
ScreenPoint(), point,
1.0f, 1.0f,
1.0f, 1.0f,
mLastTouchInput.modifiers); mLastTouchInput.modifiers);

Просмотреть файл

@ -455,6 +455,9 @@ public:
// point is implementation-specific, but can for example be the midpoint // point is implementation-specific, but can for example be the midpoint
// between the very first and very last touch. This is in device pixels and // between the very first and very last touch. This is in device pixels and
// are the coordinates on the screen of this midpoint. // are the coordinates on the screen of this midpoint.
// For PINCHGESTURE_END events, this instead will hold the coordinates of
// the remaining finger, if there is one. If there isn't one then it will
// store -1, -1.
ScreenPoint mFocusPoint; ScreenPoint mFocusPoint;
// |mFocusPoint| transformed to the local coordinates of the APZC targeted // |mFocusPoint| transformed to the local coordinates of the APZC targeted