Highlight hovered inspector categories

This commit is contained in:
Jummit 2021-09-13 18:53:59 +02:00
parent 41562b9198
commit 38b312404b

View File

@ -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<InputEvent> &p_event) {
} else {
fold();
}
} else if (mb.is_valid() && !mb->is_pressed()) {
update();
}
}