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 CheckForSwipeUp() { if (inputController.TouchPosition.y > inputController.StartTouchPosition.y + swipeDistance) { Debug.Log("Swipe up!", this); Reset(); hasSwipedUp = true; SwipedUp?.Invoke(); } }
protected virtual void OnSwipedUp(double x, double y) => SwipedUp?.Invoke(this, new SwipedEventArgs(_view, x, y));
public void OnSwipeUp() => SwipedUp?.Invoke(this, EventArgs.Empty);
public void RaiseSwipedUp() { SwipedUp?.Invoke(this, new EventArgs()); }