1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 03:45:08 +00:00

LibGUI: GTableView scrolling ranges should be based on the available area.

We have to subtract the headers and scrollbars to get the correct behavior.
This commit is contained in:
Andreas Kling 2019-03-01 11:04:55 +01:00
parent 6c2089c59d
commit 9c21874d33

View file

@ -47,10 +47,12 @@ void GTableView::resize_event(GResizeEvent& event)
void GTableView::update_scrollbar_ranges()
{
int excess_height = max(0, (item_count() * item_height()) - height());
int available_height = height() - header_height() - m_horizontal_scrollbar->height();
int excess_height = max(0, (item_count() * item_height()) - available_height);
m_vertical_scrollbar->set_range(0, excess_height);
int excess_width = max(0, content_width() - width());
int available_width = width() - m_vertical_scrollbar->width();
int excess_width = max(0, content_width() - available_width);
m_horizontal_scrollbar->set_range(0, excess_width);
}