mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1458063 - Give a name to the special (-1,-1) value of a pinch gesture event's focus point. r=kats
MozReview-Commit-ID: AtitjK2eCGa --HG-- extra : rebase_source : c2090b54e21f885876808a68347421f277ca66c3
This commit is contained in:
parent
ad612541e7
commit
5db812fe01
@ -1619,7 +1619,7 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(const PinchGestureInput& aEvent
|
||||
}
|
||||
|
||||
// Non-negative focus point would indicate that one finger is still down
|
||||
if (aEvent.mLocalFocusPoint.x != -1 && aEvent.mLocalFocusPoint.y != -1) {
|
||||
if (aEvent.mLocalFocusPoint != PinchGestureInput::BothFingersLifted()) {
|
||||
if (mZoomConstraints.mAllowZoom) {
|
||||
mPanDirRestricted = false;
|
||||
mX.StartTouch(aEvent.mLocalFocusPoint.x, aEvent.mTime);
|
||||
|
@ -478,7 +478,7 @@ nsEventStatus GestureEventListener::HandleInputTouchEnd()
|
||||
case GESTURE_PINCH:
|
||||
if (mTouches.Length() < 2) {
|
||||
SetState(GESTURE_NONE);
|
||||
ParentLayerPoint point(-1, -1);
|
||||
ParentLayerPoint point = PinchGestureInput::BothFingersLifted();
|
||||
if (mTouches.Length() == 1) {
|
||||
// As user still keeps one finger down the event's focus point should
|
||||
// contain meaningful data.
|
||||
|
@ -49,7 +49,7 @@ CreateSingleTouchData(int32_t aIdentifier, ScreenIntCoord aX, ScreenIntCoord aY)
|
||||
|
||||
PinchGestureInput
|
||||
CreatePinchGestureInput(PinchGestureInput::PinchGestureType aType,
|
||||
const ScreenIntPoint& aFocus,
|
||||
const ScreenPoint& aFocus,
|
||||
float aCurrentSpan, float aPreviousSpan)
|
||||
{
|
||||
ParentLayerPoint localFocus(aFocus.x, aFocus.y);
|
||||
@ -136,9 +136,8 @@ PinchWithPinchInput(const RefPtr<InputReceiver>& aTarget,
|
||||
}
|
||||
actualStatus = aTarget->ReceiveInputEvent(
|
||||
CreatePinchGestureInput(PinchGestureInput::PINCHGESTURE_END,
|
||||
// note: negative values here tell APZC
|
||||
// not to turn the pinch into a pan
|
||||
ScreenIntPoint(-1, -1), 10.0 * aScale, 10.0 * aScale),
|
||||
PinchGestureInput::BothFingersLifted<ScreenPixel>(),
|
||||
10.0 * aScale, 10.0 * aScale),
|
||||
nullptr);
|
||||
if (aOutEventStatuses) {
|
||||
(*aOutEventStatuses)[2] = actualStatus;
|
||||
|
@ -438,7 +438,7 @@ public:
|
||||
// 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.
|
||||
// store |BothFingersLifted()|.
|
||||
ScreenPoint mFocusPoint;
|
||||
|
||||
// |mFocusPoint| transformed to the local coordinates of the APZC targeted
|
||||
@ -452,6 +452,20 @@ public:
|
||||
// This is only really relevant during a PINCHGESTURE_SCALE because when it is
|
||||
// of this type then there must have been a history of spans.
|
||||
ParentLayerCoord mPreviousSpan;
|
||||
|
||||
// A special value for mFocusPoint used in PINCHGESTURE_END events to
|
||||
// indicate that both fingers have been lifted. If only one finger has
|
||||
// been lifted, the coordinates of the remaining finger are expected to
|
||||
// be stored in mFocusPoint.
|
||||
// For pinch events that were not triggered by touch gestures, the
|
||||
// value of mFocusPoint in a PINCHGESTURE_END event is always expected
|
||||
// to be this value.
|
||||
// For convenience, we allow retrieving this value in any coordinate system.
|
||||
// Since it's a special value, no conversion is needed.
|
||||
template <typename Units = ParentLayerPixel>
|
||||
static gfx::PointTyped<Units> BothFingersLifted() {
|
||||
return gfx::PointTyped<Units>{-1, -1};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user