Browse Source

Nav: marking NavId as hovered in ButtonBehavior() doesn't check for ActiveId.

Aimed at allowing activating another item with a shortcut without losing NavId.
Initial logic from c2cb2a69, with minor amends db5f1b79c, cea78cc57.
pull/6085/merge
ocornut 10 months ago
parent
commit
095665977f
  1. 2
      docs/CHANGELOG.txt
  2. 2
      imgui_widgets.cpp

2
docs/CHANGELOG.txt

@ -47,6 +47,8 @@ Breaking changes:
Other changes:
- Nav: keyboard/gamepad activation mark widgets as held to give better visual feedback.
- Nav: tweak to logic marking navigated item as hovered when using keyboard, allowing
the hover highlight to stay even while another item is activated.
- Fixed SetKeyboardFocusHere() not working when current nav focus is in different scope,
regression from 1.90.1 related to code scoping Tab presses to local scope. (#7226) [@bratpilz]
- Debug Tools: Metrics: Fixed debug break in SetShortcutRouting() not handling ImGuiMod_Shortcut redirect.

2
imgui_widgets.cpp

@ -599,7 +599,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
// Gamepad/Keyboard navigation
// We report navigated item as hovered but we don't set g.HoveredId to not interfere with mouse.
if (g.NavId == id && !g.NavDisableHighlight && g.NavDisableMouseHover && (g.ActiveId == 0 || g.ActiveId == id || g.ActiveId == window->MoveId))
if (g.NavId == id && !g.NavDisableHighlight && g.NavDisableMouseHover)
if (!(flags & ImGuiButtonFlags_NoHoveredOnFocus))
hovered = true;
if (g.NavActivateDownId == id)

Loading…
Cancel
Save