From d10641b04a3757884193b64753b9728c686d7aa9 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 17 Jan 2024 14:02:07 +0100 Subject: [PATCH] Nav: keyboard/gamepad activation mark widgets as held to give better visual feedback. --- docs/CHANGELOG.txt | 1 + imgui_widgets.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index dd5eeb36..be244c93 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -46,6 +46,7 @@ Breaking 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, 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. diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 6b16f55b..2b648a60 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -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) { // 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(); } if (pressed)