mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Internals: Reintroducing LastActiveIdTimer because it is useful and to reduce merge conflicts. (#1537)
This commit is contained in:
parent
d4b151076c
commit
08e20ae465
@ -2115,7 +2115,14 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
g.ActiveIdIsJustActivated = (g.ActiveId != id);
|
g.ActiveIdIsJustActivated = (g.ActiveId != id);
|
||||||
if (g.ActiveIdIsJustActivated)
|
if (g.ActiveIdIsJustActivated)
|
||||||
|
{
|
||||||
g.ActiveIdTimer = 0.0f;
|
g.ActiveIdTimer = 0.0f;
|
||||||
|
if (id != 0)
|
||||||
|
{
|
||||||
|
g.LastActiveId = id;
|
||||||
|
g.LastActiveIdTimer = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
g.ActiveId = id;
|
g.ActiveId = id;
|
||||||
g.ActiveIdAllowNavDirFlags = 0;
|
g.ActiveIdAllowNavDirFlags = 0;
|
||||||
g.ActiveIdAllowOverlap = false;
|
g.ActiveIdAllowOverlap = false;
|
||||||
@ -3568,6 +3575,7 @@ void ImGui::NewFrame()
|
|||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
if (g.ActiveId)
|
if (g.ActiveId)
|
||||||
g.ActiveIdTimer += g.IO.DeltaTime;
|
g.ActiveIdTimer += g.IO.DeltaTime;
|
||||||
|
g.LastActiveIdTimer += g.IO.DeltaTime;
|
||||||
g.ActiveIdPreviousFrame = g.ActiveId;
|
g.ActiveIdPreviousFrame = g.ActiveId;
|
||||||
g.ActiveIdIsAlive = false;
|
g.ActiveIdIsAlive = false;
|
||||||
g.ActiveIdIsJustActivated = false;
|
g.ActiveIdIsJustActivated = false;
|
||||||
|
@ -627,6 +627,8 @@ struct ImGuiContext
|
|||||||
ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
|
ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
|
||||||
ImGuiWindow* ActiveIdWindow;
|
ImGuiWindow* ActiveIdWindow;
|
||||||
ImGuiInputSource ActiveIdSource; // Activating with mouse or nav (gamepad/keyboard)
|
ImGuiInputSource ActiveIdSource; // Activating with mouse or nav (gamepad/keyboard)
|
||||||
|
ImGuiID LastActiveId; // Store the last non-zero ActiveId, useful for animation.
|
||||||
|
float LastActiveIdTimer; // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
|
||||||
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.
|
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.
|
||||||
ImVector<ImGuiColMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
|
ImVector<ImGuiColMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
|
||||||
ImVector<ImGuiStyleMod> StyleModifiers; // Stack for PushStyleVar()/PopStyleVar()
|
ImVector<ImGuiStyleMod> StyleModifiers; // Stack for PushStyleVar()/PopStyleVar()
|
||||||
@ -762,6 +764,8 @@ struct ImGuiContext
|
|||||||
ActiveIdClickOffset = ImVec2(-1,-1);
|
ActiveIdClickOffset = ImVec2(-1,-1);
|
||||||
ActiveIdWindow = NULL;
|
ActiveIdWindow = NULL;
|
||||||
ActiveIdSource = ImGuiInputSource_None;
|
ActiveIdSource = ImGuiInputSource_None;
|
||||||
|
LastActiveId = 0;
|
||||||
|
LastActiveIdTimer = 0.0f;
|
||||||
MovingWindow = NULL;
|
MovingWindow = NULL;
|
||||||
NextTreeNodeOpenVal = false;
|
NextTreeNodeOpenVal = false;
|
||||||
NextTreeNodeOpenCond = 0;
|
NextTreeNodeOpenCond = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user