mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
LibGUI: Account for scrollbar width when calculating autoscroll delta
This commit is contained in:
parent
994e33b0f7
commit
53cfc6ec9f
Notes:
sideshowbarker
2024-07-18 03:19:53 +09:00
Author: https://github.com/metmo
Commit: 53cfc6ec9f
Pull-request: https://github.com/SerenityOS/serenity/pull/10150
1 changed files with 4 additions and 4 deletions
|
@ -242,13 +242,13 @@ Gfx::IntPoint AbstractScrollableWidget::automatic_scroll_delta_from_position(con
|
|||
|
||||
if (pos.y() < m_autoscroll_threshold)
|
||||
delta.set_y(clamp(-(m_autoscroll_threshold - pos.y()), -m_autoscroll_threshold, 0));
|
||||
else if (pos.y() > height() - m_autoscroll_threshold)
|
||||
delta.set_y(clamp(m_autoscroll_threshold - (height() - pos.y()), 0, m_autoscroll_threshold));
|
||||
else if (pos.y() > widget_inner_rect().height() - m_autoscroll_threshold)
|
||||
delta.set_y(clamp(m_autoscroll_threshold - (widget_inner_rect().height() - pos.y()), 0, m_autoscroll_threshold));
|
||||
|
||||
if (pos.x() < m_autoscroll_threshold)
|
||||
delta.set_x(clamp(-(m_autoscroll_threshold - pos.x()), -m_autoscroll_threshold, 0));
|
||||
else if (pos.x() > width() - m_autoscroll_threshold)
|
||||
delta.set_x(clamp(m_autoscroll_threshold - (width() - pos.x()), 0, m_autoscroll_threshold));
|
||||
else if (pos.x() > widget_inner_rect().width() - m_autoscroll_threshold)
|
||||
delta.set_x(clamp(m_autoscroll_threshold - (widget_inner_rect().width() - pos.x()), 0, m_autoscroll_threshold));
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue