From cea8ed485fbf0dff7bc1ca304cf5dd7f07a98c10 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 6 Oct 2021 23:28:29 -0500 Subject: [PATCH] Improve scrolling behavior for continuous scroll input --- Limelight/Input/StreamView.m | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index 9c7df6c..f90cdf7 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -459,17 +459,20 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; switch (gesture.state) { case UIGestureRecognizerStateBegan: case UIGestureRecognizerStateChanged: - case UIGestureRecognizerStateEnded: break; + case UIGestureRecognizerStateEnded: default: // Ignore recognition failure and other states + lastScrollTranslation = CGPointMake(0, 0); return; } - short velocityY = [gesture velocityInView:self].y; - if (velocityY != 0) { - LiSendHighResScrollEvent(velocityY); + CGPoint currentScrollTranslation = [gesture translationInView:self]; + short translationDeltaY = ((currentScrollTranslation.y - lastScrollTranslation.y) / self.bounds.size.height) * 120; // WHEEL_DELTA + if (translationDeltaY != 0) { + LiSendHighResScrollEvent(translationDeltaY); + lastScrollTranslation = currentScrollTranslation; } }