summaryrefslogtreecommitdiffstats
path: root/scene/gui/flow_container.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/flow_container.cpp')
-rw-r--r--scene/gui/flow_container.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/scene/gui/flow_container.cpp b/scene/gui/flow_container.cpp
index f77d66fe98..d32c75fbcd 100644
--- a/scene/gui/flow_container.cpp
+++ b/scene/gui/flow_container.cpp
@@ -30,6 +30,7 @@
#include "flow_container.h"
+#include "scene/gui/texture_rect.h"
#include "scene/theme/theme_db.h"
struct _LineData {
@@ -203,7 +204,23 @@ void FlowContainer::_resort() {
}
}
- if (vertical) { /* VERTICAL */
+ bool is_unsupported_texture_rect = false;
+ if (lines_data.size() > 1) {
+ TextureRect *trect = Object::cast_to<TextureRect>(child);
+ if (trect) {
+ TextureRect::ExpandMode mode = trect->get_expand_mode();
+ if (mode == TextureRect::EXPAND_FIT_WIDTH || mode == TextureRect::EXPAND_FIT_WIDTH_PROPORTIONAL ||
+ mode == TextureRect::EXPAND_FIT_HEIGHT || mode == TextureRect::EXPAND_FIT_HEIGHT_PROPORTIONAL) {
+ is_unsupported_texture_rect = true;
+ }
+ }
+ }
+
+ if (is_unsupported_texture_rect) {
+ // Temporary fix for editor crash. Changing size of TextureRect with EXPAND_FIT_* ExpandModes can lead to infinite loop if child items are moved between lines.
+ WARN_PRINT_ONCE("TextureRects with Fit Expand Modes are currently not supported inside FlowContainers with multiple lines");
+ child_size = child->get_size();
+ } else if (vertical) { /* VERTICAL */
if (child->get_h_size_flags().has_flag(SIZE_FILL) || child->get_h_size_flags().has_flag(SIZE_SHRINK_CENTER) || child->get_h_size_flags().has_flag(SIZE_SHRINK_END)) {
child_size.width = line_data.min_line_height;
}
@@ -250,7 +267,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;
}