From 6874419564535c424b03bba5814231df306e40f7 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Fri, 10 Feb 2023 00:55:44 +0100 Subject: [PATCH] Make touch pad scroll in the subtitle grid smoother --- src/base_grid.cpp | 4 +++- src/base_grid.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/base_grid.cpp b/src/base_grid.cpp index 151b15be0..5d8bf17ee 100644 --- a/src/base_grid.cpp +++ b/src/base_grid.cpp @@ -530,7 +530,9 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) { if (event.GetWheelRotation() != 0) { if (ForwardMouseWheelEvent(this, event)) { int step = shift ? h / lineHeight - 2 : 3; - ScrollTo(yPos - step * event.GetWheelRotation() / event.GetWheelDelta()); + scrollWheelProgress += event.GetWheelRotation(); + ScrollTo(yPos - step * (scrollWheelProgress / event.GetWheelDelta())); + scrollWheelProgress %= event.GetWheelDelta(); } return; } diff --git a/src/base_grid.h b/src/base_grid.h index 366189588..2f28a21dc 100644 --- a/src/base_grid.h +++ b/src/base_grid.h @@ -46,6 +46,7 @@ class BaseGrid final : public wxWindow { std::vector connections; int lineHeight = 1; ///< Height of a line in pixels in the current font bool holding = false; ///< Is a drag selection in process? + int scrollWheelProgress = 0; ///< How close we are to reaching a full mouse wheel step wxFont font; ///< Current grid font wxScrollBar *scrollBar; ///< The grid's scrollbar bool byFrame = false; ///< Should times be displayed as frame numbers