mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-24 02:14:22 +00:00
Nav: Fixed a few widgets from not setting reference keyboard/gamepad navigation ID when activated with mouse.
This commit is contained in:
parent
17a7084b57
commit
82754561e2
4 changed files with 11 additions and 2 deletions
|
|
@ -571,6 +571,8 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||
ClearActiveID();
|
||||
else
|
||||
SetActiveID(id, window); // Hold on ID
|
||||
if (!(flags & ImGuiButtonFlags_NoNavFocus))
|
||||
SetFocusID(id, window);
|
||||
g.ActiveIdMouseButton = mouse_button_clicked;
|
||||
FocusWindow(window);
|
||||
}
|
||||
|
|
@ -581,6 +583,8 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||
const bool has_repeated_at_least_once = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay;
|
||||
if (!has_repeated_at_least_once)
|
||||
pressed = true;
|
||||
if (!(flags & ImGuiButtonFlags_NoNavFocus))
|
||||
SetFocusID(id, window);
|
||||
ClearActiveID();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue