mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00:00
LibWeb: Set scroll step size to a value consistent with Qt/Ladybird
This probably should not be hardcoded, but for now having a consistent value makes things feel nice.
This commit is contained in:
parent
29fb3a1a60
commit
22d06a4ff0
|
@ -146,6 +146,8 @@ Painting::PaintableBox const* EventHandler::paint_root() const
|
|||
|
||||
bool EventHandler::handle_mousewheel(CSSPixelPoint position, unsigned button, unsigned buttons, unsigned int modifiers, int wheel_delta_x, int wheel_delta_y)
|
||||
{
|
||||
constexpr int scroll_step_size = 24;
|
||||
|
||||
if (m_browsing_context->active_document())
|
||||
m_browsing_context->active_document()->update_layout();
|
||||
|
||||
|
@ -181,7 +183,7 @@ bool EventHandler::handle_mousewheel(CSSPixelPoint position, unsigned button, un
|
|||
if (node->dispatch_event(UIEvents::WheelEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::wheel, offset.x(), offset.y(), position.x(), position.y(), wheel_delta_x, wheel_delta_y, buttons, button).release_value_but_fixme_should_propagate_errors())) {
|
||||
if (auto* page = m_browsing_context->page()) {
|
||||
if (m_browsing_context == &page->top_level_browsing_context())
|
||||
page->client().page_did_request_scroll(wheel_delta_x * 20, wheel_delta_y * 20);
|
||||
page->client().page_did_request_scroll(wheel_delta_x * scroll_step_size, wheel_delta_y * scroll_step_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue