From 36a21a43af5f89ef8ea38cc5a8eebcf0252cb8e6 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Wed, 4 Jan 2023 14:16:57 +0800 Subject: [PATCH] Fix Tree overflow without scrolling being enabled --- scene/gui/tree.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index de3e416d6be..577513fb6df 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2758,12 +2758,6 @@ Size2 Tree::get_internal_min_size() const { void Tree::update_scrollbars() { Size2 size = get_size(); - int tbh; - if (show_column_titles) { - tbh = _get_title_button_height(); - } else { - tbh = 0; - } Size2 hmin = h_scroll->get_combined_minimum_size(); Size2 vmin = v_scroll->get_combined_minimum_size(); @@ -2775,14 +2769,15 @@ void Tree::update_scrollbars() { h_scroll->set_end(Point2(size.width - vmin.width, size.height)); Size2 min = get_internal_min_size(); + const real_t tree_content_height = size.height - hmin.height - _get_title_button_height(); - if (min.height < size.height - hmin.height) { + if (min.height < tree_content_height) { v_scroll->hide(); cache.offset.y = 0; } else { v_scroll->show(); v_scroll->set_max(min.height); - v_scroll->set_page(size.height - hmin.height - tbh); + v_scroll->set_page(tree_content_height); cache.offset.y = v_scroll->get_value(); }