From 43ee5d73e9f524320489720639942ff60bbfaf54 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 21 Aug 2016 11:45:50 +0200 Subject: [PATCH] Nav: Hovering MenuItem/Selectable with mouse makes NavId, matching what seems to be Windows beahvior at least for menus (#323) --- imgui.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index fccc7e2d..f47a4108 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -9484,6 +9484,13 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl if (flags & ImGuiSelectableFlags_Disabled) selected = false; + // Hovering selectable with mouse updates NavId accordingly so navigation can be resumed with gamepad/keyboard (this doesn't happen on most widgets) + if (hovered && !g.NavDisableMouseHover && (g.IO.MouseDelta.x != 0.0f || g.IO.MouseDelta.y != 0.0f)) + { + g.NavDisableHighlight = true; + SetNavId(id); + } + // Render if (hovered || selected) {