mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Add as_sortable_control() to unify Container checks
This commit is contained in:
@@ -35,16 +35,10 @@
|
||||
Size2 AspectRatioContainer::get_minimum_size() const {
|
||||
Size2 ms;
|
||||
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;
|
||||
}
|
||||
if (!c->is_visible()) {
|
||||
continue;
|
||||
}
|
||||
Size2 minsize = c->get_combined_minimum_size();
|
||||
ms = ms.max(minsize);
|
||||
}
|
||||
@@ -107,13 +101,10 @@ void AspectRatioContainer::_notification(int p_what) {
|
||||
bool rtl = is_layout_rtl();
|
||||
Size2 size = 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;
|
||||
}
|
||||
|
||||
// Temporary fix for editor crash.
|
||||
TextureRect *trect = Object::cast_to<TextureRect>(c);
|
||||
|
||||
Reference in New Issue
Block a user