public SwipeGestureRecognizer() { PanUpdated += (_, e) => { if (e.StatusType == GestureStatus.Running) { translatedX = e.TotalX; translatedY = e.TotalY; } else if (e.StatusType == GestureStatus.Completed) { if (translatedX < 0 && Math.Abs(translatedX) > Math.Abs(translatedY)) { SwipedLeft?.Invoke(); } else if (translatedX > 0 && translatedX > Math.Abs(translatedY)) { SwipedRight?.Invoke(); } else if (translatedY < 0 && Math.Abs(translatedY) > Math.Abs(translatedX)) { SwipedUp?.Invoke(); } else if (translatedY > 0 && translatedY > Math.Abs(translatedX)) { SwipedDown?.Invoke(); } } }; }
private void CheckForSwipeDown() { if (inputController.TouchPosition.y < inputController.StartTouchPosition.y - swipeDistance) { Debug.Log("Swipe down!", this); Reset(); hasSwipedDown = true; SwipedDown?.Invoke(); } }
protected virtual void OnSwipedDown(double x, double y) => SwipedDown?.Invoke(this, new SwipedEventArgs(_view, x, y));
public void OnSwipeDown() => SwipedDown?.Invoke(this, EventArgs.Empty);
public void RaiseSwipedDown() { SwipedDown?.Invoke(this, new EventArgs()); }