mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
LibGUI: Scroll selection into view when the IconView is first laid out
If we set selection before the IconView is laid out, it has no size. So it can't correctly calculate where to scroll. Forcing scroll after the first resize fixes that.
This commit is contained in:
parent
6e16a5cdfa
commit
d64d2e4d09
2 changed files with 8 additions and 0 deletions
|
@ -72,6 +72,12 @@ void IconView::resize_event(ResizeEvent& event)
|
|||
{
|
||||
AbstractView::resize_event(event);
|
||||
update_content_size();
|
||||
|
||||
if (!m_had_valid_size) {
|
||||
m_had_valid_size = true;
|
||||
if (!selection().is_empty())
|
||||
scroll_into_view(selection().first());
|
||||
}
|
||||
}
|
||||
|
||||
void IconView::reinit_item_cache() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue