From 28548641305dea98320ac9b29d68a7a23eccc7a6 Mon Sep 17 00:00:00 2001 From: James Buck Date: Mon, 22 Apr 2019 20:33:53 -0500 Subject: [PATCH] Fix drawing of checkable editor properties - Make text cutoff respect checkbox icon's width - Get checkbox icon from EditorIcons instead of CheckBox (cherry picked from commit c230c6db98e98c3a473e13d6116481fef9fa4ac1) --- editor/editor_inspector.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index bcc46d0ddc3..2802cbf7e40 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -211,12 +211,14 @@ void EditorProperty::_notification(int p_what) { } int ofs = 0; + int text_limit = text_size; + if (checkable) { Ref checkbox; if (checked) - checkbox = get_icon("checked", "CheckBox"); + checkbox = get_icon("GuiChecked", "EditorIcons"); else - checkbox = get_icon("unchecked", "CheckBox"); + checkbox = get_icon("GuiUnchecked", "EditorIcons"); Color color2(1, 1, 1); if (check_hover) { @@ -228,12 +230,11 @@ void EditorProperty::_notification(int p_what) { draw_texture(checkbox, check_rect.position, color2); ofs += get_constant("hseparator", "Tree"); ofs += checkbox->get_width(); + text_limit -= ofs; } else { check_rect = Rect2(); } - int text_limit = text_size; - if (can_revert) { Ref reload_icon = get_icon("ReloadSmall", "EditorIcons"); text_limit -= reload_icon->get_width() + get_constant("hseparator", "Tree") * 2;