From 38b312404ba4db8c6b2c804346ab34bdf183ae83 Mon Sep 17 00:00:00 2001 From: Jummit Date: Mon, 13 Sep 2021 18:53:59 +0200 Subject: [PATCH] Highlight hovered inspector categories --- editor/editor_inspector.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index d3841ad6c07..3834751b8ff 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1266,9 +1266,13 @@ void EditorInspectorSection::_notification(int p_what) { } header_height += get_theme_constant(SNAME("vseparation"), SNAME("Tree")); + Rect2 header_rect = Rect2(Vector2(), Vector2(get_size().width, header_height)); Color c = bg_color; c.a *= 0.4; - draw_rect(Rect2(Vector2(), Vector2(get_size().width, header_height)), c); + if (foldable && header_rect.has_point(get_local_mouse_position())) { + c = c.lightened(Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT) ? -0.05 : 0.2); + } + draw_rect(header_rect, c); const int arrow_margin = 2; const int arrow_width = arrow.is_valid() ? arrow->get_width() : 0; @@ -1315,12 +1319,14 @@ void EditorInspectorSection::_notification(int p_what) { if (dropping) { dropping_unfold_timer->start(); } + update(); } break; case NOTIFICATION_MOUSE_EXIT: { if (dropping) { dropping_unfold_timer->stop(); } + update(); } break; } } @@ -1395,6 +1401,8 @@ void EditorInspectorSection::gui_input(const Ref &p_event) { } else { fold(); } + } else if (mb.is_valid() && !mb->is_pressed()) { + update(); } }