summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-10 15:07:18 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-10 15:07:18 +0100
commit29d89caafe2dece0e4e371c3a978ad0f65d9680e (patch)
tree6b525d789cfc34332c9717926f7942f363688bf3 /scene/gui
parentfd55321da94d3274cafad63a16d9d36d46409e64 (diff)
parent0c766ef271db2b3bb18c591d3ff2d2a6f9e1e450 (diff)
Merge pull request #72714 from DarkMessiah/fix-unlimited-text-in-tree
Fix unlimited text rendering in Tree if width <= 0
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/tree.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 0f39715851..f8c2e9f4ad 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1775,10 +1775,10 @@ void Tree::draw_item_rect(TreeItem::Cell &p_cell, const Rect2i &p_rect, const Co
RID ci = get_canvas_item();
- if (rtl) {
+ if (rtl && rect.size.width > 0) {
Point2 draw_pos = rect.position;
draw_pos.y += Math::floor((rect.size.y - p_cell.text_buf->get_size().y) / 2.0);
- p_cell.text_buf->set_width(MAX(0, rect.size.width));
+ p_cell.text_buf->set_width(rect.size.width);
if (p_ol_size > 0 && p_ol_color.a > 0) {
p_cell.text_buf->draw_outline(ci, draw_pos, p_ol_size, p_ol_color);
}
@@ -1800,10 +1800,10 @@ void Tree::draw_item_rect(TreeItem::Cell &p_cell, const Rect2i &p_rect, const Co
rect.size.x -= bmsize.x + theme_cache.h_separation;
}
- if (!rtl) {
+ if (!rtl && rect.size.width > 0) {
Point2 draw_pos = rect.position;
draw_pos.y += Math::floor((rect.size.y - p_cell.text_buf->get_size().y) / 2.0);
- p_cell.text_buf->set_width(MAX(0, rect.size.width));
+ p_cell.text_buf->set_width(rect.size.width);
if (p_ol_size > 0 && p_ol_color.a > 0) {
p_cell.text_buf->draw_outline(ci, draw_pos, p_ol_size, p_ol_color);
}