From 1533292f090972a1324827a91141ae8d67f3b0de Mon Sep 17 00:00:00 2001 From: coumcashier <122149176+coumcashier@users.noreply.github.com> Date: Fri, 10 Nov 2023 19:50:58 +0100 Subject: [PATCH] Fix storing invalid item height values in `ItemList` The height of the last N items is incorrectly overwritten with the max height of first row (N = number of columns). This happen in the first iteration of the while loop. Moving this code inside if (all_fit) makes sure the last rows height is only updated at the end when max height (max_h) is calculated for the last row. --- scene/gui/item_list.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 343301e9c43..02d44caa1c3 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1431,11 +1431,11 @@ void ItemList::force_update_list_size() { } } - for (int j = items.size() - 1; j >= 0 && col > 0; j--, col--) { - items.write[j].rect_cache.size.y = max_h; - } - if (all_fit) { + for (int j = items.size() - 1; j >= 0 && col > 0; j--, col--) { + items.write[j].rect_cache.size.y = max_h; + } + float page = MAX(0, size.height - theme_cache.panel_style->get_minimum_size().height); float max = MAX(page, ofs.y + max_h); if (auto_height) {