From 2171167c19a6b29f7c33f2f8fb60bd3d401e8d40 Mon Sep 17 00:00:00 2001 From: jsjtxietian Date: Mon, 3 Jun 2024 11:57:30 +0800 Subject: [PATCH] Fix scroll bar will disapplear in scroll container the second time open it --- scene/gui/scroll_container.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 1f4d1dbf5255..212d132156a7 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -42,8 +42,8 @@ Size2 ScrollContainer::get_minimum_size() const { largest_child_min_size = Size2(); for (int i = 0; i < get_child_count(); i++) { - Control *c = as_sortable_control(get_child(i)); - if (!c) { + Control *c = Object::cast_to(get_child(i)); + if (!c || !c->is_visible() || c->is_set_as_top_level()) { continue; } if (c == h_scroll || c == v_scroll) {