Skip to content

Commit

Permalink
Fix GridContainer max row/column calculations not skipping hidden chi…
Browse files Browse the repository at this point in the history
…ldren
  • Loading branch information
kleonc committed May 8, 2023
1 parent adee8cf commit 0ce6ef7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scene/gui/grid_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ void GridContainer::_notification(int p_what) {

int hsep = get_constant("hseparation");
int vsep = get_constant("vseparation");
int max_col = MIN(get_child_count(), columns);
int max_row = ceil((float)get_child_count() / (float)columns);

// Compute the per-column/per-row data.
int valid_controls_index = 0;
Expand Down Expand Up @@ -78,6 +76,9 @@ void GridContainer::_notification(int p_what) {
}
}

int max_col = MIN(valid_controls_index, columns);
int max_row = ceil((float)valid_controls_index / (float)columns);

// Consider all empty columns expanded.
for (int i = valid_controls_index; i < columns; i++) {
col_expanded.insert(i);
Expand Down

0 comments on commit 0ce6ef7

Please sign in to comment.