private void OnReleasedSecond(PointerInput input, double time) { _pinching = false; _secondPressed = false; var pinchDistance = Vector2.Distance(_posLastFirst, _posLastSecond); PinchFinished?.Invoke(new PinchInput() { InputId = input.InputId, PinchDistance = pinchDistance, PinchDeltaDistance = pinchDistance - _pinchLastDistance, Pointer0CurrentPosition = _posLastFirst, Pointer0StartPosition = _pinchPosStartFirst, Pointer1CurrentPosition = _posLastSecond, Pointer1StartPosition = _pinchPosStartSecond }); }
private void OnReleasedFirst(PointerInput input, double time) { if (!activeGestures.TryGetValue(input.InputId, out var existingGesture)) { // Probably caught by UI, or the input was otherwise lost return; } activeGestures.Remove(input.InputId); existingGesture.SubmitPoint(input.Position, time); if (IsValidSwipe(ref existingGesture)) { Swiped?.Invoke(new SwipeInput(existingGesture)); } if (IsValidTap(ref existingGesture)) { Tapped?.Invoke(new TapInput(existingGesture)); } if (_pinching) { _pinching = false; var pinchDistance = Vector2.Distance(_posLastFirst, _posLastSecond); PinchFinished?.Invoke(new PinchInput() { InputId = input.InputId, PinchDistance = pinchDistance, PinchDeltaDistance = pinchDistance - _pinchLastDistance, Pointer0CurrentPosition = _posLastFirst, Pointer0StartPosition = _pinchPosStartFirst, Pointer1CurrentPosition = _posLastSecond, Pointer1StartPosition = _pinchPosStartSecond }); } DebugInfo(existingGesture); }