From edddfa5379ea881d68ac2f839759e1c73f3ea505 Mon Sep 17 00:00:00 2001 From: Giganzo <158825920+Giganzo@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:28:01 +0200 Subject: [PATCH] Add extra padding to Revert button, to make it easier to hit --- editor/editor_inspector.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 199383c3918..fde3a50a186 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -311,8 +311,9 @@ void EditorProperty::_notification(int p_what) { if (can_revert && !is_read_only()) { Ref 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();