public override int GetHashCode( ) { return(Name.GetHashCode( ) ^ MultiTap.GetHashCode( )); }
/// <summary> /// Update the various gesture interpreters with the new pointer event data /// </summary> /// <param name="pointerPoint"></param> /// <param name="pointerEventType"></param> private void UpdatePointerEvent(PointerPoint pointerPoint, PointerEventType pointerEventType) { var customGestureTypes = Enum.GetValues(typeof(CustomGestureSettings)); foreach (CustomGestureSettings gestureType in customGestureTypes) { // Skip gestures that are not flagged in the GestureSettings if (!GestureSettings.HasFlag(gestureType)) { continue; } // Check for an existing started gesture to update. // If absent, create one. if (!_gestureProgress.TryGetValue(gestureType, out IGesture gesture)) { // Build the appropriate Gesture object based on the configured CustomGestureSettings switch (gestureType) { case CustomGestureSettings.MultiTap: gesture = new MultiTap(_gestureProperties); break; case CustomGestureSettings.None: default: // This gesture type is not supported. continue; } // Add the gesture to the dictionary by type. // There will only ever be one Gesture per type being analysed by this recognizer instance. _gestureProgress.Add(gestureType, gesture); } // Track all inputs. If new, add it to the dictionary for tracking. // If not, update the existing item. if (!_inputs.TryGetValue(pointerPoint.PointerId, out PointerInput pointerInput)) { pointerInput = new PointerInput(pointerPoint, pointerEventType); _inputs.Add(pointerPoint.PointerId, pointerInput); } else { pointerInput.Update(pointerPoint, pointerEventType); _inputs[pointerPoint.PointerId] = pointerInput; } // Pipe the input data to the gesture var inputs = _inputs.Values.ToList(); switch (pointerEventType) { case PointerEventType.Down: gesture.Start(inputs); break; case PointerEventType.Move: gesture.Move(inputs); break; case PointerEventType.Up: var args = gesture.End(inputs); if (args != null) { CompleteGesture(gestureType, args); } break; } } }