Add extra padding to Revert button, to make it easier to hit
This commit is contained in:
parent
e343dbbcc1
commit
edddfa5379
|
@ -311,8 +311,9 @@ void EditorProperty::_notification(int p_what) {
|
||||||
|
|
||||||
if (can_revert && !is_read_only()) {
|
if (can_revert && !is_read_only()) {
|
||||||
Ref<Texture2D> reload_icon = get_editor_theme_icon(SNAME("ReloadSmall"));
|
Ref<Texture2D> reload_icon = get_editor_theme_icon(SNAME("ReloadSmall"));
|
||||||
|
Size2 padding = Size2(4, 4) * EDSCALE;
|
||||||
text_limit -= reload_icon->get_width() + get_theme_constant(SNAME("h_separation"), SNAME("Tree"));
|
text_limit -= reload_icon->get_width() + get_theme_constant(SNAME("h_separation"), SNAME("Tree"));
|
||||||
revert_rect = Rect2(ofs + text_limit, (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height());
|
revert_rect = Rect2(ofs + text_limit - (padding.width / 2), (size.height - (reload_icon->get_height() + padding.height)) / 2, reload_icon->get_width() + padding.width, reload_icon->get_height() + padding.height);
|
||||||
|
|
||||||
Color color2(1, 1, 1);
|
Color color2(1, 1, 1);
|
||||||
if (revert_hover) {
|
if (revert_hover) {
|
||||||
|
@ -321,9 +322,9 @@ void EditorProperty::_notification(int p_what) {
|
||||||
color2.b *= 1.2;
|
color2.b *= 1.2;
|
||||||
}
|
}
|
||||||
if (rtl) {
|
if (rtl) {
|
||||||
draw_texture(reload_icon, Vector2(size.width - revert_rect.position.x - reload_icon->get_width(), revert_rect.position.y), color2);
|
draw_texture(reload_icon, Vector2(size.width - revert_rect.position.x - (padding.width / 2) - reload_icon->get_width(), revert_rect.position.y + (padding.height / 2)), color2);
|
||||||
} else {
|
} else {
|
||||||
draw_texture(reload_icon, revert_rect.position, color2);
|
draw_texture(reload_icon, revert_rect.position + padding / 2, color2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
revert_rect = Rect2();
|
revert_rect = Rect2();
|
||||||
|
|
Loading…
Reference in New Issue