|
@@ -5472,13 +5472,16 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|
|
const bool was_selected = selected;
|
|
|
bool hovered, held;
|
|
|
bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags);
|
|
|
- // Hovering selectable with mouse updates NavId accordingly so navigation can be resumed with gamepad/keyboard (this doesn't happen on most widgets)
|
|
|
- if (pressed || hovered)
|
|
|
+
|
|
|
+ // Update NavId when clicking or when Hovering (this doesn't happen on most widgets), so navigation can be resumed with gamepad/keyboard
|
|
|
+ if (pressed || (hovered && (flags & ImGuiSelectableFlags_SetNavIdOnHover)))
|
|
|
+ {
|
|
|
if (!g.NavDisableMouseHover && g.NavWindow == window && g.NavLayer == window->DC.NavLayerCurrent)
|
|
|
{
|
|
|
g.NavDisableHighlight = true;
|
|
|
SetNavID(id, window->DC.NavLayerCurrent);
|
|
|
}
|
|
|
+ }
|
|
|
if (pressed)
|
|
|
MarkItemEdited(id);
|
|
|
|
|
@@ -6178,7 +6181,9 @@ bool ImGui::MenuItem(const char* label, const char* shortcut, bool selected, boo
|
|
|
ImVec2 pos = window->DC.CursorPos;
|
|
|
ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
|
|
|
- ImGuiSelectableFlags flags = ImGuiSelectableFlags_PressedOnRelease | (enabled ? 0 : ImGuiSelectableFlags_Disabled);
|
|
|
+ // We've been using the equivalent of ImGuiSelectableFlags_SetNavIdOnHover on all Selectable() since early Nav system days (commit 43ee5d73),
|
|
|
+ // but I am unsure whether this should be kept at all. For now moved it to be an opt-in feature used by menus only.
|
|
|
+ ImGuiSelectableFlags flags = ImGuiSelectableFlags_PressedOnRelease | ImGuiSelectableFlags_SetNavIdOnHover | (enabled ? 0 : ImGuiSelectableFlags_Disabled);
|
|
|
bool pressed;
|
|
|
if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)
|
|
|
{
|