/// <summary> /// Invokes evaluation of the given touch history if there is more than one element. /// </summary> /// <param name="history">History of touch positions.</param> public static void CallTouchHistoryEvaluation(TouchHistory history) { if (history.trace.Count <= 1) { return; } SwipeEvaluator.EvaluateEndedTouchHistory(history); }
/// <summary> /// Invoke action that an ongoing swipe got detected. /// </summary> /// <param name="touch">Information of the swiping touch.</param> public static void CallOngoingSwipe(Touch touch) { // Simulate touch history to create ongoing swipe arguments. var history = new TouchHistory(0f, touch.position); if (history.trace.ContainsKey(0f)) { history.trace.Remove(0f); } history.trace.Add(0f, touch.position - touch.deltaPosition); history.trace.Add(touch.deltaTime, touch.position); var swipeArgs = SwipeEvaluator.CreateSwipeTriggerArgs(history); MobileInput.OnSwipeMoving?.Invoke(swipeArgs); OnSwipeDetected?.Invoke(swipeArgs); }