diff options
Diffstat (limited to 'scene/gui/center_container.cpp')
-rw-r--r-- | scene/gui/center_container.cpp | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/scene/gui/center_container.cpp b/scene/gui/center_container.cpp index f3306783f3..33ec4006ae 100644 --- a/scene/gui/center_container.cpp +++ b/scene/gui/center_container.cpp @@ -69,22 +69,32 @@ bool CenterContainer::is_using_top_left() const { return use_top_left; } +Vector<int> CenterContainer::get_allowed_size_flags_horizontal() const { + return Vector<int>(); +} + +Vector<int> CenterContainer::get_allowed_size_flags_vertical() const { + return Vector<int>(); +} + void CenterContainer::_notification(int p_what) { - if (p_what == NOTIFICATION_SORT_CHILDREN) { - Size2 size = get_size(); - 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; - } + switch (p_what) { + case NOTIFICATION_SORT_CHILDREN: { + Size2 size = get_size(); + 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; + } - Size2 minsize = c->get_combined_minimum_size(); - Point2 ofs = use_top_left ? (-minsize * 0.5).floor() : ((size - minsize) / 2.0).floor(); - fit_child_in_rect(c, Rect2(ofs, minsize)); - } + Size2 minsize = c->get_combined_minimum_size(); + Point2 ofs = use_top_left ? (-minsize * 0.5).floor() : ((size - minsize) / 2.0).floor(); + fit_child_in_rect(c, Rect2(ofs, minsize)); + } + } break; } } |