From 0242ca7cbf4566f4dc3746cf5fb14eb78990d698 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sun, 19 May 2024 13:45:31 +0800 Subject: [PATCH] Fix long category name display in Inspector --- editor/editor_inspector.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index c049f515ebe..8316d6a0e98 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -944,16 +944,18 @@ void EditorInspectorCategory::_notification(int p_what) { if (icon.is_valid()) { w += hs + icon->get_width(); } + w = MIN(w, get_size().width - hs * 2); int ofs = (get_size().width - w) / 2; if (icon.is_valid()) { draw_texture(icon, Point2(ofs, (get_size().height - icon->get_height()) / 2).floor()); ofs += hs + icon->get_width(); + w -= hs + icon->get_width(); } Color color = get_color("font_color", "Tree"); - draw_string(font, Point2(ofs, font->get_ascent() + (get_size().height - font->get_height()) / 2).floor(), label, color, get_size().width); + draw_string(font, Point2(ofs, font->get_ascent() + (get_size().height - font->get_height()) / 2).floor(), label, color, w); } }