mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +00:00
LibWeb: Make handle_mousewheel wheel delta use pixels
This commit is contained in:
parent
7d588db6c8
commit
0facfd3257
Notes:
sideshowbarker
2024-07-17 08:43:11 +09:00
Author: https://github.com/bplaat
Commit: 0facfd3257
Pull-request: https://github.com/SerenityOS/serenity/pull/20460
Reviewed-by: https://github.com/MacDue
Reviewed-by: https://github.com/kalenikaliaksandr
3 changed files with 9 additions and 8 deletions
|
@ -285,10 +285,10 @@ void WebContentView::wheelEvent(QWheelEvent* event)
|
|||
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);
|
||||
constexpr int scroll_step_size = 24;
|
||||
client().async_mouse_wheel(to_content_position(position), button, buttons, modifiers, step_x * scroll_step_size, step_y * scroll_step_size);
|
||||
event->accept();
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue