summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Offenhäuser <offenhaeuser@protonmail.com>2022-10-27 19:50:00 +0200
committerAndreas Kling <kling@serenityos.org>2022-11-19 15:42:08 +0100
commit0308300b78fcacd1c8ab5c193d870dc9874c1e6e (patch)
tree25f9030fe5352ad46a694c832b9641e2386c9dbd
parent9b1331a984a45c4f941cd3e37de5feba43401209 (diff)
downloadserenity-0308300b78fcacd1c8ab5c193d870dc9874c1e6e.zip
PDFViewer: Take the mousewheel delta into account for scrolling
We now respect the system-wide setting for scroll speed, where we would previously use a fixed step.
-rw-r--r--Userland/Applications/PDFViewer/PDFViewer.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Userland/Applications/PDFViewer/PDFViewer.cpp b/Userland/Applications/PDFViewer/PDFViewer.cpp
index 7c790d8def..3d19c550b2 100644
--- a/Userland/Applications/PDFViewer/PDFViewer.cpp
+++ b/Userland/Applications/PDFViewer/PDFViewer.cpp
@@ -189,14 +189,15 @@ void PDFViewer::mousewheel_event(GUI::MouseEvent& event)
}
auto& scrollbar = event.shift() ? horizontal_scrollbar() : vertical_scrollbar();
+ auto delta = abs(event.wheel_delta_y() * 20);
if (m_page_view_mode == PageViewMode::Multiple) {
if (scrolled_down) {
if (scrollbar.value() != scrollbar.max())
- scrollbar.increase_slider_by(20);
+ scrollbar.increase_slider_by(delta);
} else {
if (scrollbar.value() > 0)
- scrollbar.decrease_slider_by(20);
+ scrollbar.decrease_slider_by(delta);
}
} else {
if (scrolled_down) {
@@ -206,7 +207,7 @@ void PDFViewer::mousewheel_event(GUI::MouseEvent& event)
scrollbar.set_value(0);
}
} else {
- scrollbar.increase_slider_by(20);
+ scrollbar.increase_slider_by(delta);
}
} else {
if (scrollbar.value() == 0) {
@@ -215,7 +216,7 @@ void PDFViewer::mousewheel_event(GUI::MouseEvent& event)
scrollbar.set_value(scrollbar.max());
}
} else {
- scrollbar.decrease_slider_by(20);
+ scrollbar.decrease_slider_by(delta);
}
}
}