Skip to content

Commit

Permalink
Fix GridContainer minimum size when there's a hidden parent
Browse files Browse the repository at this point in the history
When calculating minimum size, GridContainer only looks at children that are
returned from `as_sortable_control()`. That defaults to only showing children
visible in the tree, so if the grid has a hidden parent the minimum size
becomes (0, 0).

After this change only the child itself needs to be visible, making
`GridContainer::get_minimum_size()` behave the same way as other controls.

Fixes godotengine#91722.
  • Loading branch information
anniryynanen authored and 2nafish117 committed Aug 5, 2024
1 parent a124a4a commit 2c03780
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scene/gui/grid_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ Size2 GridContainer::get_minimum_size() const {

int valid_controls_index = 0;
for (int i = 0; i < get_child_count(); i++) {
Control *c = as_sortable_control(get_child(i));
Control *c = as_sortable_control(get_child(i), SortableVisbilityMode::VISIBLE);
if (!c) {
continue;
}
Expand Down

0 comments on commit 2c03780

Please sign in to comment.