mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
Ladybird: Fix scroll step size
The Qt docs are not that clear, but to get the number of steps the wheel was scrolled you divide by 120 (which when multiplied by wheelScrollLines() gives the scroll offset).
This commit is contained in:
parent
22d06a4ff0
commit
7b7ba38655
Notes:
sideshowbarker
2024-07-17 07:43:44 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/7b7ba38655 Pull-request: https://github.com/SerenityOS/serenity/pull/20383
1 changed files with 7 additions and 3 deletions
|
@ -282,9 +282,13 @@ void WebContentView::wheelEvent(QWheelEvent* event)
|
|||
auto button = get_button_from_qt_event(*event);
|
||||
auto buttons = get_buttons_from_qt_event(*event);
|
||||
auto modifiers = get_modifiers_from_qt_mouse_event(*event);
|
||||
auto num_degrees = -event->angleDelta() / 8;
|
||||
client().async_mouse_wheel(to_content_position(position), button, buttons, modifiers, num_degrees.x(), num_degrees.y());
|
||||
|
||||
auto num_degrees = -event->angleDelta();
|
||||
float delta_x = -num_degrees.x() / 120;
|
||||
float delta_y = num_degrees.y() / 120;
|
||||
// Note: This does not use the QScrollBar's step size as LibWeb multiples this by a step size internally.
|
||||
auto step_x = delta_x * QApplication::wheelScrollLines() * devicePixelRatio();
|
||||
auto step_y = delta_y * QApplication::wheelScrollLines() * devicePixelRatio();
|
||||
client().async_mouse_wheel(to_content_position(position), button, buttons, modifiers, step_x, step_y);
|
||||
event->accept();
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue