diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-04-23 19:12:08 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-04-23 19:12:08 +0200 |
commit | a3b9344a37a60c07ed48a49eb0c5575e7f881340 (patch) | |
tree | 946d2f7ed0638bbafcc080d3ccedd9e88218fc42 | |
parent | d7abefd0a3552afbd33cabec87b101543b3a3e6d (diff) | |
parent | 98d7d623509748ab14c390455327decb8bfdbc47 (diff) | |
download | redot-engine-a3b9344a37a60c07ed48a49eb0c5575e7f881340.tar.gz |
Merge pull request #91044 from timothyqiu/column-title
Fix wrong Tree column title position
-rw-r--r-- | scene/gui/tree.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 0c48fac29f..982473deee 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -4344,7 +4344,7 @@ void Tree::_notification(int p_what) { } default: { - text_pos.x += sb->get_offset().x + (tbrect.size.width - columns[i].text_buf->get_size().x) / 2; + text_pos.x += (tbrect.size.width - columns[i].text_buf->get_size().x) / 2; break; } } @@ -4726,7 +4726,8 @@ int Tree::get_column_minimum_width(int p_column) const { // Check if the visible title of the column is wider. if (show_column_titles) { - min_width = MAX(theme_cache.font->get_string_size(columns[p_column].xl_title, HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.font_size).width + theme_cache.panel_style->get_margin(SIDE_LEFT) + theme_cache.panel_style->get_margin(SIDE_RIGHT), min_width); + const float padding = theme_cache.title_button->get_margin(SIDE_LEFT) + theme_cache.title_button->get_margin(SIDE_RIGHT); + min_width = MAX(theme_cache.font->get_string_size(columns[p_column].xl_title, HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.font_size).width + padding, min_width); } if (!columns[p_column].clip_content) { |