Make touch pad scroll in the subtitle grid smoother

This commit is contained in:
arch1t3cht 2023-02-10 00:55:44 +01:00
parent c0f337a992
commit 6874419564
2 changed files with 4 additions and 1 deletions

View file

@ -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;
}

View file

@ -46,6 +46,7 @@ class BaseGrid final : public wxWindow {
std::vector<agi::signal::Connection> 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