1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 00:17:46 +00:00

Ladybird: Do not try to use pixelDelta() to calculate wheel offset

Documentation says that pixelDelta() is not reliable across platforms
so always using angleDelta() should produce more predictable scrolling
behaviour.
This commit is contained in:
Aliaksandr Kalenik 2023-08-05 12:45:26 +02:00 committed by Andreas Kling
parent 6f0a93b5df
commit ac2d9d9273

View file

@ -282,13 +282,8 @@ 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_pixels = -event->pixelDelta() / m_inverse_pixel_scaling_ratio;
auto num_degrees = -event->angleDelta() / 8;
if (!num_pixels.isNull()) {
client().async_mouse_wheel(to_content_position(position), button, buttons, modifiers, num_pixels.x(), num_pixels.y());
} else if (!num_degrees.isNull()) {
client().async_mouse_wheel(to_content_position(position), button, buttons, modifiers, num_degrees.x(), num_degrees.y());
}
client().async_mouse_wheel(to_content_position(position), button, buttons, modifiers, num_degrees.x(), num_degrees.y());
event->accept();
return;