mirror of
https://github.com/godotengine/godot.git
synced 2024-11-25 21:52:51 +00:00
Fix drawing of checkable editor properties
- Make text cutoff respect checkbox icon's width - Get checkbox icon from EditorIcons instead of CheckBox
This commit is contained in:
parent
33a0011ab2
commit
c230c6db98
@ -211,12 +211,14 @@ void EditorProperty::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ofs = 0;
|
int ofs = 0;
|
||||||
|
int text_limit = text_size;
|
||||||
|
|
||||||
if (checkable) {
|
if (checkable) {
|
||||||
Ref<Texture> checkbox;
|
Ref<Texture> checkbox;
|
||||||
if (checked)
|
if (checked)
|
||||||
checkbox = get_icon("checked", "CheckBox");
|
checkbox = get_icon("GuiChecked", "EditorIcons");
|
||||||
else
|
else
|
||||||
checkbox = get_icon("unchecked", "CheckBox");
|
checkbox = get_icon("GuiUnchecked", "EditorIcons");
|
||||||
|
|
||||||
Color color2(1, 1, 1);
|
Color color2(1, 1, 1);
|
||||||
if (check_hover) {
|
if (check_hover) {
|
||||||
@ -228,12 +230,11 @@ void EditorProperty::_notification(int p_what) {
|
|||||||
draw_texture(checkbox, check_rect.position, color2);
|
draw_texture(checkbox, check_rect.position, color2);
|
||||||
ofs += get_constant("hseparator", "Tree");
|
ofs += get_constant("hseparator", "Tree");
|
||||||
ofs += checkbox->get_width();
|
ofs += checkbox->get_width();
|
||||||
|
text_limit -= ofs;
|
||||||
} else {
|
} else {
|
||||||
check_rect = Rect2();
|
check_rect = Rect2();
|
||||||
}
|
}
|
||||||
|
|
||||||
int text_limit = text_size;
|
|
||||||
|
|
||||||
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user