Internals: Added LastActiveId, LastActiveIdTimer. (#1537)

This commit is contained in:
omar
2018-01-05 15:33:24 +01:00
parent 4c90529c62
commit 007f4034c9
2 changed files with 12 additions and 0 deletions

View File

@ -1929,7 +1929,14 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
ImGuiContext& g = *GImGui;
g.ActiveIdIsJustActivated = (g.ActiveId != id);
if (g.ActiveIdIsJustActivated)
{
g.ActiveIdTimer = 0.0f;
if (id != 0)
{
g.LastActiveId = id;
g.LastActiveIdTimer = 0.0f;
}
}
g.ActiveId = id;
g.ActiveIdAllowOverlap = false;
g.ActiveIdIsAlive |= (id != 0);
@ -2308,6 +2315,7 @@ void ImGui::NewFrame()
ClearActiveID();
if (g.ActiveId)
g.ActiveIdTimer += g.IO.DeltaTime;
g.LastActiveIdTimer += g.IO.DeltaTime;
g.ActiveIdPreviousFrame = g.ActiveId;
g.ActiveIdIsAlive = false;
g.ActiveIdIsJustActivated = false;