mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-04 12:08:03 +01:00
Nav: ButtonBehavior() keep _displaying_ NavId item as howered when refocusing or moving window, which is consistent with IsItemHovered() and reduce noise/flicker (#787)
This commit is contained in:
parent
c42baf392a
commit
db5f1b79cd
@ -2205,6 +2205,7 @@ static void NavMoveRequestCancel()
|
|||||||
NavUpdateAnyRequestFlag();
|
NavUpdateAnyRequestFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We get there when either NavId == id, or when g.NavAnyRequest is set (which is updated by NavUpdateAnyRequestFlag above)
|
||||||
static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGuiID id)
|
static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGuiID id)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
@ -6758,11 +6759,10 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gamepad/Keyboard navigation
|
// Gamepad/Keyboard navigation
|
||||||
if (g.NavId == id && !g.NavDisableHighlight && (g.ActiveId == 0 || g.ActiveId == id))
|
// 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.ActiveId == 0 || g.ActiveId == id || g.ActiveId == window->MoveId))
|
||||||
// We report navigated item as hovered but we don't set g.HoveredId to not interfere with mouse
|
|
||||||
hovered = true;
|
hovered = true;
|
||||||
}
|
|
||||||
if (g.NavActivateDownId == id)
|
if (g.NavActivateDownId == id)
|
||||||
{
|
{
|
||||||
bool nav_activated_by_code = (g.NavActivateId == id);
|
bool nav_activated_by_code = (g.NavActivateId == id);
|
||||||
|
Loading…
Reference in New Issue
Block a user