diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-02-15 08:09:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-15 08:09:51 +0100 |
commit | c4779196b95928818391fcb006bae4fc5944c057 (patch) | |
tree | 370d32d9b881ad6d07848a9c844be99a08c67e52 | |
parent | b3507ab0cdf25e470b1e4d977ed0bea32a305c1b (diff) | |
parent | dbc380af59b28de8243f945c6cb965bee83efadf (diff) |
Merge pull request #58125 from fire-forge/editor_property_overlap_fix
Fix EditorProperty icon overlapping text with checkbox
-rw-r--r-- | editor/editor_inspector.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 73acea43fd..d5cd61d792 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -258,7 +258,7 @@ void EditorProperty::_notification(int p_what) { } int ofs = get_theme_constant(SNAME("font_offset")); - int text_limit = text_size; + int text_limit = text_size - ofs; if (checkable) { Ref<Texture2D> checkbox; @@ -280,8 +280,9 @@ void EditorProperty::_notification(int p_what) { } else { draw_texture(checkbox, check_rect.position, color2); } - ofs += get_theme_constant(SNAME("hseparator"), SNAME("Tree")) + checkbox->get_width() + get_theme_constant(SNAME("hseparation"), SNAME("CheckBox")); - text_limit -= ofs; + int check_ofs = get_theme_constant(SNAME("hseparator"), SNAME("Tree")) + checkbox->get_width() + get_theme_constant(SNAME("hseparation"), SNAME("CheckBox")); + ofs += check_ofs; + text_limit -= check_ofs; } else { check_rect = Rect2(); } @@ -289,7 +290,7 @@ void EditorProperty::_notification(int p_what) { if (can_revert && !is_read_only()) { Ref<Texture2D> reload_icon = get_theme_icon(SNAME("ReloadSmall"), SNAME("EditorIcons")); text_limit -= reload_icon->get_width() + get_theme_constant(SNAME("hseparator"), SNAME("Tree")) * 2; - revert_rect = Rect2(text_limit + get_theme_constant(SNAME("hseparator"), SNAME("Tree")), (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height()); + revert_rect = Rect2(ofs + text_limit, (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height()); Color color2(1, 1, 1); if (revert_hover) { |