Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Make extra adjustments to the minsize of inspector properties

Michael Alexsandereffabd0b718c
diff --git a/editor/inspector/editor_inspector.cpp b/editor/inspector/editor_inspector.cpp
index fd92f8cf3a3..4fe5b611910 100644
--- a/editor/inspector/editor_inspector.cpp
+++ b/editor/inspector/editor_inspector.cpp
@@ -251,29 +251,32 @@ Size2 EditorProperty::get_minimum_size() const {
bool label_empty = label.is_empty();
if (!label_empty) {
- ms.width += theme_cache.font_offset + theme_cache.horizontal_separation;
+ // Add an extra 1, since text clipping is off if the width is 0 or less.
+ ms.width += theme_cache.font_offset + theme_cache.horizontal_separation + 1;
}
- // Always take the revert and pin values into account, since their state can be changed at whim
+ int padding_sep = theme_cache.padding + theme_cache.horizontal_separation;
+
+ // Always take the revert button into account, since values are changed constantly
// and we don't want to update the min width every time this happens.
- {
- if (!is_read_only()) {
- ms.width += theme_cache.revert_icon->get_width() + theme_cache.padding + theme_cache.horizontal_separation;
- }
+ if (!is_read_only()) {
+ ms.width += theme_cache.revert_icon->get_width() + padding_sep;
+ }
- ms.width += theme_cache.pin_icon->get_width() + theme_cache.horizontal_separation;
+ if (pinned) {
+ ms.width += theme_cache.pin_icon->get_width() + padding_sep;
}
if (keying) {
- ms.width += theme_cache.key_icon->get_width() + theme_cache.padding + theme_cache.horizontal_separation;
+ ms.width += theme_cache.key_icon->get_width() + padding_sep;
}
if (deletable) {
- ms.width += theme_cache.delete_icon->get_width() + theme_cache.padding + theme_cache.horizontal_separation;
+ ms.width += theme_cache.delete_icon->get_width() + padding_sep;
}
if (checkable) {
- ms.width += theme_cache.checked_icon->get_width() + theme_cache.padding + theme_cache.horizontal_separation;
+ ms.width += theme_cache.checked_icon->get_width() + padding_sep;
}
Size2 ls = left_container->get_combined_minimum_size();