Skip to content

Commit

Permalink
Merge pull request #94085 from anniryynanen/min-size-hidden-parent
Browse files Browse the repository at this point in the history
Fix container minimum size with hidden parent
  • Loading branch information
akien-mga committed Jul 17, 2024
2 parents 0268cea + a9c91f4 commit 78120c6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion scene/gui/aspect_ratio_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
Size2 AspectRatioContainer::get_minimum_size() const {
Size2 ms;
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
2 changes: 1 addition & 1 deletion scene/gui/center_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Size2 CenterContainer::get_minimum_size() const {
}
Size2 ms;
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
2 changes: 1 addition & 1 deletion scene/gui/flow_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ Size2 FlowContainer::get_minimum_size() const {
Size2i minimum;

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
9 changes: 5 additions & 4 deletions scene/gui/split_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ void SplitContainerDragger::_notification(int p_what) {
}
}

Control *SplitContainer::_get_sortable_child(int p_idx) const {
Control *SplitContainer::_get_sortable_child(int p_idx, SortableVisbilityMode p_visibility_mode) const {
int idx = 0;

for (int i = 0; i < get_child_count(false); i++) {
Control *c = as_sortable_control(get_child(i, false));
Control *c = as_sortable_control(get_child(i, false), p_visibility_mode);
if (!c) {
continue;
}
Expand Down Expand Up @@ -258,7 +258,8 @@ Size2 SplitContainer::get_minimum_size() const {
int sep = (dragger_visibility != DRAGGER_HIDDEN_COLLAPSED) ? MAX(theme_cache.separation, vertical ? g->get_height() : g->get_width()) : 0;

for (int i = 0; i < 2; i++) {
if (!_get_sortable_child(i)) {
Control *child = _get_sortable_child(i, SortableVisbilityMode::VISIBLE);
if (!child) {
break;
}

Expand All @@ -270,7 +271,7 @@ Size2 SplitContainer::get_minimum_size() const {
}
}

Size2 ms = _get_sortable_child(i)->get_combined_minimum_size();
Size2 ms = child->get_combined_minimum_size();

if (vertical) {
minimum.height += ms.height;
Expand Down
2 changes: 1 addition & 1 deletion scene/gui/split_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class SplitContainer : public Container {
Ref<Texture2D> _get_grabber_icon() const;
void _compute_middle_sep(bool p_clamp);
void _resort();
Control *_get_sortable_child(int p_idx) const;
Control *_get_sortable_child(int p_idx, SortableVisbilityMode p_visibility_mode = SortableVisbilityMode::VISIBLE_IN_TREE) const;

protected:
bool is_fixed = false;
Expand Down

0 comments on commit 78120c6

Please sign in to comment.