Fix container minimum size with hidden parent

This commit is contained in:
Anni Ryynänen 2024-07-08 18:35:26 +03:00
parent ec02d406ca
commit a9c91f4eef
No known key found for this signature in database
GPG Key ID: 0C29030C4FA87DDC
5 changed files with 9 additions and 8 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
@ -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;
}
@ -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;

View File

@ -82,7 +82,7 @@ private:
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;