From cea78cc576eae0380f9cf43333e3b7e89730b663 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 24 Jan 2018 10:24:41 +0100 Subject: [PATCH] Nav: Update hovered logic, so IsItemHovered and ButtonBehavior are more consistent with each other. The known case this fixes is nav focusing on a color button, tooltip appears, mouse move: previously tooltip would stay up. (#787) --- imgui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 03c411d5c..bafcb158f 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2367,7 +2367,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - if (g.NavDisableMouseHover) + if (g.NavDisableMouseHover && !g.NavDisableHighlight) return IsItemFocused(); // Test for bounding box overlap, as updated as ItemAdd() @@ -7331,7 +7331,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.ActiveId == 0 || g.ActiveId == id || g.ActiveId == window->MoveId)) + if (g.NavId == id && !g.NavDisableHighlight && g.NavDisableMouseHover && (g.ActiveId == 0 || g.ActiveId == id || g.ActiveId == window->MoveId)) hovered = true; if (g.NavActivateDownId == id)