Nav: keyboard/gamepad activation mark widgets as held to give better visual feedback.

This commit is contained in:
ocornut 2024-01-17 14:02:07 +01:00
parent 03417cc77d
commit d10641b04a
2 changed files with 4 additions and 1 deletions

View File

@ -46,6 +46,7 @@ Breaking changes:
Other changes: Other changes:
- Nav: keyboard/gamepad activation mark widgets as held to give better visual feedback.
- Fixed SetKeyboardFocusHere() not working when current nav focus is in different scope, - 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] 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. - Debug Tools: Metrics: Fixed debug break in SetShortcutRouting() not handling ImGuiMod_Shortcut redirect.

View File

@ -666,7 +666,9 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
else if (g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad) else if (g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad)
{ {
// When activated using Nav, we hold on the ActiveID until activation button is released // When activated using Nav, we hold on the ActiveID until activation button is released
if (g.NavActivateDownId != id) if (g.NavActivateDownId == id)
held = true;
else
ClearActiveID(); ClearActiveID();
} }
if (pressed) if (pressed)