summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI
diff options
context:
space:
mode:
authorMarcus Nilsson <brainbomb@gmail.com>2021-09-19 20:26:22 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-29 23:58:55 +0200
commit53cfc6ec9f63e0f52301fea4a949a1f9029125b9 (patch)
tree807996e6c8eefcbd7b7842b872824db96c9c95a1 /Userland/Libraries/LibGUI
parent994e33b0f7cad0d3a399fb2e3fa254ff711c82fe (diff)
downloadserenity-53cfc6ec9f63e0f52301fea4a949a1f9029125b9.zip
LibGUI: Account for scrollbar width when calculating autoscroll delta
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r--Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp b/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp
index 6ca74f6834..5c5203f49e 100644
--- a/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp
+++ b/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp
@@ -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;
}