protected internal virtual void UpdateStateByEvent(MotionEvent curr) { MotionEvent prev = mPrevEvent; // Reset mCurrEvent if (mCurrEvent != null) { mCurrEvent.Recycle(); mCurrEvent = null; } mCurrEvent = MotionEvent.Obtain(curr); // Delta time mTimeDelta = curr.EventTime - prev.EventTime; // Pressure mCurrPressure = curr.GetPressure(curr.ActionIndex); mPrevPressure = prev.GetPressure(prev.ActionIndex); }
/// <summary> /// Updates the current state with the given event. /// </summary> /// <param name="curr">The current event.</param> protected virtual void UpdateStateByEvent(MotionEvent curr) { MotionEvent prev = _previousEvent; // Reset _currentEvent. if (_currentEvent != null) { _currentEvent.Recycle(); _currentEvent = null; } _currentEvent = MotionEvent.Obtain(curr); // Delta time. _timeDelta = 0; if (prev != null) { _timeDelta = curr.EventTime - prev.EventTime; // Pressure. _previousPressure = prev.GetPressure(prev.ActionIndex); } _currentPressure = curr.GetPressure(curr.ActionIndex); }
protected internal virtual void ResetState() { if (mPrevEvent != null) { mPrevEvent.Recycle(); mPrevEvent = null; } if (mCurrEvent != null) { mCurrEvent.Recycle(); mCurrEvent = null; } mGestureInProgress = false; }
/// <summary> /// Resets the state. /// </summary> protected virtual void ResetState() { if (_previousEvent != null) { _previousEvent.Recycle(); _previousEvent = null; } if (_currentEvent != null) { _currentEvent.Recycle(); _currentEvent = null; } _gestureInProgress = false; }