summaryrefslogtreecommitdiffstats
path: root/scene/gui/margin_container.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/margin_container.cpp')
-rw-r--r--scene/gui/margin_container.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp
index 6d331afbb5..06e4a7cc13 100644
--- a/scene/gui/margin_container.cpp
+++ b/scene/gui/margin_container.cpp
@@ -37,13 +37,7 @@ Size2 MarginContainer::get_minimum_size() const {
for (int i = 0; i < get_child_count(); i++) {
Control *c = Object::cast_to<Control>(get_child(i));
- if (!c) {
- continue;
- }
- if (c->is_set_as_top_level()) {
- continue;
- }
- if (!c->is_visible()) {
+ if (!c || !c->is_visible() || c->is_set_as_top_level()) {
continue;
}
@@ -103,13 +97,10 @@ void MarginContainer::_notification(int p_what) {
Size2 s = get_size();
for (int i = 0; i < get_child_count(); i++) {
- Control *c = Object::cast_to<Control>(get_child(i));
+ Control *c = as_sortable_control(get_child(i));
if (!c) {
continue;
}
- if (c->is_set_as_top_level()) {
- continue;
- }
int w = s.width - theme_cache.margin_left - theme_cache.margin_right;
int h = s.height - theme_cache.margin_top - theme_cache.margin_bottom;