1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-24 07:40:22 +01:00

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.
This commit is contained in:
ocornut 2024-01-17 14:52:05 +01:00
parent d10641b04a
commit 095665977f
2 changed files with 3 additions and 1 deletions

View File

@ -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.

View File

@ -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)