diff options
Diffstat (limited to 'scene/gui/panel_container.cpp')
-rw-r--r-- | scene/gui/panel_container.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/scene/gui/panel_container.cpp b/scene/gui/panel_container.cpp index 306ef4936f..76fde26b26 100644 --- a/scene/gui/panel_container.cpp +++ b/scene/gui/panel_container.cpp @@ -35,17 +35,13 @@ Size2 PanelContainer::get_minimum_size() const { Size2 ms; for (int i = 0; i < get_child_count(); i++) { - Control *c = Object::cast_to<Control>(get_child(i)); - if (!c || !c->is_visible()) { - continue; - } - if (c->is_set_as_top_level()) { + Control *c = as_sortable_control(get_child(i)); + if (!c) { continue; } Size2 minsize = c->get_combined_minimum_size(); - ms.width = MAX(ms.width, minsize.width); - ms.height = MAX(ms.height, minsize.height); + ms = ms.max(minsize); } if (theme_cache.panel_style.is_valid()) { @@ -88,11 +84,8 @@ void PanelContainer::_notification(int p_what) { } for (int i = 0; i < get_child_count(); i++) { - Control *c = Object::cast_to<Control>(get_child(i)); - if (!c || !c->is_visible_in_tree()) { - continue; - } - if (c->is_set_as_top_level()) { + Control *c = as_sortable_control(get_child(i)); + if (!c) { continue; } |