1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-13 18:50:58 +01:00

Nav: Hovering MenuItem/Selectable with mouse makes NavId, matching what seems to be Windows beahvior at least for menus (#323)

This commit is contained in:
ocornut 2016-08-21 11:45:50 +02:00
parent 30c04d0dbe
commit 43ee5d73e9

View File

@ -9484,6 +9484,13 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
if (flags & ImGuiSelectableFlags_Disabled) if (flags & ImGuiSelectableFlags_Disabled)
selected = false; 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 // Render
if (hovered || selected) if (hovered || selected)
{ {