mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Nav: SetFocusID() update NavWindow and NavRectRel just as we get them. Needed by upcoming commit, committing separately as I'm curious if it has any side-effect. (#787)
This commit is contained in:
parent
83416fa5da
commit
7d14262202
12
imgui.cpp
12
imgui.cpp
@ -1980,14 +1980,20 @@ ImGuiID ImGui::GetActiveID()
|
|||||||
return g.ActiveId;
|
return g.ActiveId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assume that SetFocusID() is called in the context where its NavLayer is the current window nav layer.
|
|
||||||
void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window)
|
void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window)
|
||||||
{
|
{
|
||||||
IM_ASSERT(id != 0);
|
IM_ASSERT(id != 0);
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
|
||||||
|
// Assume that SetActiveID() is called in the context where its NavLayer is the current layer, which is the case everywhere we call it.
|
||||||
|
const int nav_layer = window->DC.NavLayerCurrent;
|
||||||
g.NavId = id;
|
g.NavId = id;
|
||||||
g.NavLayer = window->DC.NavLayerCurrent;
|
g.NavWindow = window;
|
||||||
window->NavLastIds[window->DC.NavLayerCurrent] = id;
|
g.NavLayer = nav_layer;
|
||||||
|
window->NavLastIds[nav_layer] = id;
|
||||||
|
if (window->DC.LastItemId == id)
|
||||||
|
window->NavRectRel[nav_layer] = ImRect(window->DC.LastItemRect.Min - window->Pos, window->DC.LastItemRect.Max - window->Pos);
|
||||||
|
|
||||||
if (g.ActiveIdSource == ImGuiInputSource_Nav)
|
if (g.ActiveIdSource == ImGuiInputSource_Nav)
|
||||||
g.NavDisableMouseHover = true;
|
g.NavDisableMouseHover = true;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user