Fix EditorProperty text and icon overlap bugs

(cherry picked from commit dbc380af59)
This commit is contained in:
FireForge 2022-02-13 22:12:53 -06:00 committed by Rémi Verschelde
parent 21bdadbf79
commit 8aa30eee2f

View file

@ -238,7 +238,7 @@ void EditorProperty::_notification(int p_what) {
} }
int ofs = get_constant("font_offset"); int ofs = get_constant("font_offset");
int text_limit = text_size; int text_limit = text_size - ofs;
if (checkable) { if (checkable) {
Ref<Texture> checkbox; Ref<Texture> checkbox;
@ -256,8 +256,10 @@ void EditorProperty::_notification(int p_what) {
} }
check_rect = Rect2(ofs, ((size.height - checkbox->get_height()) / 2), checkbox->get_width(), checkbox->get_height()); check_rect = Rect2(ofs, ((size.height - checkbox->get_height()) / 2), checkbox->get_width(), checkbox->get_height());
draw_texture(checkbox, check_rect.position, color2); draw_texture(checkbox, check_rect.position, color2);
ofs += get_constant("hseparator", "Tree") + checkbox->get_width() + get_constant("hseparation", "CheckBox");
text_limit -= ofs; int check_ofs = get_constant("hseparator", "Tree") + checkbox->get_width() + get_constant("hseparation", "CheckBox");
ofs += check_ofs;
text_limit -= check_ofs;
} else { } else {
check_rect = Rect2(); check_rect = Rect2();
} }
@ -265,7 +267,7 @@ void EditorProperty::_notification(int p_what) {
if (can_revert) { if (can_revert) {
Ref<Texture> reload_icon = get_icon("ReloadSmall", "EditorIcons"); Ref<Texture> reload_icon = get_icon("ReloadSmall", "EditorIcons");
text_limit -= reload_icon->get_width() + get_constant("hseparator", "Tree") * 2; text_limit -= reload_icon->get_width() + get_constant("hseparator", "Tree") * 2;
revert_rect = Rect2(text_limit + get_constant("hseparator", "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); Color color2(1, 1, 1);
if (revert_hover) { if (revert_hover) {