private void UiElementOnManipulationCompleted(object sender, ManipulationCompletedEventArgs e) { var gesture = gestureRecognizer.Gesture; if (isDoubleTapping && Math.Abs(e.TotalManipulation.Translation.X) < 0.02) { PinchAction?.Invoke(); } else if (gesture == TouchGestureType.MoveRightToLeft) { SwipeLeftAction?.Invoke(); } else if (gesture == TouchGestureType.MoveLeftToRight) { SwipeRightAction?.Invoke(); } else if (gesture == TouchGestureType.MoveBottomToUp) { SwipeUpAction?.Invoke(); } else if (gesture == TouchGestureType.MoveTopToBottom) { SwipeDownAction?.Invoke(); } else if (gesture == TouchGestureType.SingleTap) { SingleTapAction?.Invoke(); } }
public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { var dx = e2.RawX - e1.RawX; var dy = e2.RawY - e1.RawY; if (Math.Abs(dx) > SwipeThresholdInPoints * Density) { if (dx > 0) { SwipeRightAction?.Invoke(e2); } else { SwipeLeftAction?.Invoke(e2); } } else if (Math.Abs(dy) > SwipeThresholdInPoints * Density) { if (dy > 0) { SwipeBottomAction?.Invoke(e2); } else { SwipeTopAction?.Invoke(e2); } } return(true); }