mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 10:48:41 +00:00
LibGUI: Make scrollbar thumb size relative to content size
In order to calculate a thumb size that is a representation of the visible portion (page) of the content, that information needs to be taken into account.
This commit is contained in:
@@ -107,13 +107,13 @@ void ScrollableWidget::update_scrollbar_ranges()
|
||||
auto available_size = this->available_size();
|
||||
|
||||
int excess_height = max(0, m_content_size.height() - available_size.height());
|
||||
m_vertical_scrollbar->set_range(0, excess_height);
|
||||
m_vertical_scrollbar->set_range(0, excess_height, available_size.height());
|
||||
|
||||
if (should_hide_unnecessary_scrollbars())
|
||||
m_vertical_scrollbar->set_visible(excess_height > 0);
|
||||
|
||||
int excess_width = max(0, m_content_size.width() - available_size.width());
|
||||
m_horizontal_scrollbar->set_range(0, excess_width);
|
||||
m_horizontal_scrollbar->set_range(0, excess_width, available_size.width());
|
||||
|
||||
if (should_hide_unnecessary_scrollbars())
|
||||
m_horizontal_scrollbar->set_visible(excess_width > 0);
|
||||
|
||||
Reference in New Issue
Block a user