summaryrefslogtreecommitdiffstats
path: root/editor/editor_inspector.cpp
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2024-05-11 09:51:32 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2024-05-11 09:51:32 +0800
commitfe1bf76e6f727a136e89232ff59015e580eadb74 (patch)
treeae9dcfb7a3b75f75659c6142ba2cd79503059cc9 /editor/editor_inspector.cpp
parent2ba22d1554ded08094e3869a83bd87487266ad38 (diff)
downloadredot-engine-fe1bf76e6f727a136e89232ff59015e580eadb74.tar.gz
Fix long category name display in Inspector
Diffstat (limited to 'editor/editor_inspector.cpp')
-rw-r--r--editor/editor_inspector.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 9599479c83..266901c938 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -1190,19 +1190,27 @@ void EditorInspectorCategory::_notification(int p_what) {
if (icon.is_valid()) {
w += hs + icon_size;
}
+ w = MIN(w, get_size().width - sb->get_minimum_size().width);
int ofs = (get_size().width - w) / 2;
if (icon.is_valid()) {
Size2 rect_size = Size2(icon_size, icon_size);
Point2 rect_pos = Point2(ofs, (get_size().height - icon_size) / 2).floor();
+ if (is_layout_rtl()) {
+ rect_pos.x = get_size().width - rect_pos.x - icon_size;
+ }
draw_texture_rect(icon, Rect2(rect_pos, rect_size));
ofs += hs + icon_size;
+ w -= hs + icon_size;
}
Color color = get_theme_color(SNAME("font_color"), SNAME("Tree"));
- draw_string(font, Point2(ofs, font->get_ascent(font_size) + (get_size().height - font->get_height(font_size)) / 2).floor(), label, HORIZONTAL_ALIGNMENT_LEFT, get_size().width, font_size, color);
+ if (is_layout_rtl()) {
+ ofs = get_size().width - ofs - w;
+ }
+ draw_string(font, Point2(ofs, font->get_ascent(font_size) + (get_size().height - font->get_height(font_size)) / 2).floor(), label, HORIZONTAL_ALIGNMENT_LEFT, w, font_size, color);
} break;
}
}