Add extra padding to Revert button, to make it easier to hit

This commit is contained in:
Giganzo 2024-07-25 16:28:01 +02:00
parent e343dbbcc1
commit edddfa5379
1 changed files with 4 additions and 3 deletions

View File

@ -311,8 +311,9 @@ void EditorProperty::_notification(int p_what) {
if (can_revert && !is_read_only()) {
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"));
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);
if (revert_hover) {
@ -321,9 +322,9 @@ void EditorProperty::_notification(int p_what) {
color2.b *= 1.2;
}
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 {
draw_texture(reload_icon, revert_rect.position, color2);
draw_texture(reload_icon, revert_rect.position + padding / 2, color2);
}
} else {
revert_rect = Rect2();