From 7df349ad7c6669ded659b84bbf75b09332d759dd Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 25 Feb 2024 16:25:56 -0600 Subject: [PATCH] Improve smooth scrolling precision --- Limelight/Input/StreamView.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index 8891a9b..7dedeb3 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -704,20 +704,21 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; } CGPoint currentScrollTranslation = [gesture translationInView:self]; + const short translationMultiplier = 120 * 20; // WHEEL_DELTA * 20 { - short translationDeltaY = ((currentScrollTranslation.y - lastScrollTranslation.y) / self.bounds.size.height) * 120; // WHEEL_DELTA + short translationDeltaY = ((currentScrollTranslation.y - lastScrollTranslation.y) / self.bounds.size.height) * translationMultiplier; if (translationDeltaY != 0) { - LiSendHighResScrollEvent(translationDeltaY * 20); + LiSendHighResScrollEvent(translationDeltaY); lastScrollTranslation = currentScrollTranslation; } } { - short translationDeltaX = ((currentScrollTranslation.x - lastScrollTranslation.x) / self.bounds.size.width) * 120; // WHEEL_DELTA + short translationDeltaX = ((currentScrollTranslation.x - lastScrollTranslation.x) / self.bounds.size.width) * translationMultiplier; if (translationDeltaX != 0) { // Direction is reversed from vertical scrolling - LiSendHighResHScrollEvent(-translationDeltaX * 20); + LiSendHighResHScrollEvent(-translationDeltaX); lastScrollTranslation = currentScrollTranslation; } }