1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-12-14 08:42:59 +01:00

Nav: not activating widgets with NavActivate when NavMenu is held (#323)

This commit is contained in:
ocornut 2016-07-30 11:11:17 +02:00
parent b2aaab873d
commit b3ddae07d1

View File

@ -2501,8 +2501,8 @@ static void NavUpdate()
}
}
g.NavActivateId = (g.NavId && !g.NavDisableHighlight && g.ActiveId == 0 && IsKeyPressedMap(ImGuiKey_NavActivate)) ? g.NavId : 0;
g.NavInputId = (g.NavId && !g.NavDisableHighlight && g.ActiveId == 0 && IsKeyPressedMap(ImGuiKey_NavInput)) ? g.NavId : 0;
g.NavActivateId = (g.NavId && !g.NavDisableHighlight && !g.NavWindowingTarget && g.ActiveId == 0 && IsKeyPressedMap(ImGuiKey_NavActivate)) ? g.NavId : 0;
g.NavInputId = (g.NavId && !g.NavDisableHighlight && !g.NavWindowingTarget && g.ActiveId == 0 && IsKeyPressedMap(ImGuiKey_NavInput)) ? g.NavId : 0;
if (g.NavWindow && (g.NavWindow->Flags & ImGuiWindowFlags_NoNav))
{
g.NavActivateId = g.NavInputId = 0;
@ -6157,16 +6157,16 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
{
// We report navigated item as hovered but we don't set g.HoveredId to not interfere with mouse
hovered = true;
if (IsKeyDownMap(ImGuiKey_NavActivate))
if (!g.NavWindowingTarget && IsKeyDownMap(ImGuiKey_NavActivate))
{
// Set active id so it can be queried by user via IsItemActive(), etc. but don't react to it ourselves
g.NavActivateId = g.NavId;
SetActiveID(g.NavId, window);
g.ActiveIdAllowNavMove = true;
}
if (IsKeyPressedMap(ImGuiKey_NavActivate, (flags & ImGuiButtonFlags_Repeat) != 0))
pressed = true;
}
}
bool held = false;
if (g.ActiveId == id && g.ActiveIdSource == ImGuiInputSource_Mouse)