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:
parent
b2aaab873d
commit
b3ddae07d1
@ -2501,8 +2501,8 @@ static void NavUpdate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g.NavActivateId = (g.NavId && !g.NavDisableHighlight && g.ActiveId == 0 && IsKeyPressedMap(ImGuiKey_NavActivate)) ? 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.ActiveId == 0 && IsKeyPressedMap(ImGuiKey_NavInput)) ? 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))
|
if (g.NavWindow && (g.NavWindow->Flags & ImGuiWindowFlags_NoNav))
|
||||||
{
|
{
|
||||||
g.NavActivateId = g.NavInputId = 0;
|
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
|
// We report navigated item as hovered but we don't set g.HoveredId to not interfere with mouse
|
||||||
hovered = true;
|
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
|
// Set active id so it can be queried by user via IsItemActive(), etc. but don't react to it ourselves
|
||||||
g.NavActivateId = g.NavId;
|
g.NavActivateId = g.NavId;
|
||||||
SetActiveID(g.NavId, window);
|
SetActiveID(g.NavId, window);
|
||||||
g.ActiveIdAllowNavMove = true;
|
g.ActiveIdAllowNavMove = true;
|
||||||
}
|
|
||||||
if (IsKeyPressedMap(ImGuiKey_NavActivate, (flags & ImGuiButtonFlags_Repeat) != 0))
|
if (IsKeyPressedMap(ImGuiKey_NavActivate, (flags & ImGuiButtonFlags_Repeat) != 0))
|
||||||
pressed = true;
|
pressed = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool held = false;
|
bool held = false;
|
||||||
if (g.ActiveId == id && g.ActiveIdSource == ImGuiInputSource_Mouse)
|
if (g.ActiveId == id && g.ActiveIdSource == ImGuiInputSource_Mouse)
|
||||||
|
Loading…
Reference in New Issue
Block a user