mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-25 00:56:35 +00:00
Internals: Fixed HoveredIdTimer so it is safe to call SetHoveredId() multiple times without altering the timer.
This commit is contained in:
parent
6d78045ff8
commit
15a93d6fe3
@ -2285,7 +2285,8 @@ void ImGui::SetHoveredID(ImGuiID id)
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
g.HoveredId = id;
|
g.HoveredId = id;
|
||||||
g.HoveredIdAllowOverlap = false;
|
g.HoveredIdAllowOverlap = false;
|
||||||
g.HoveredIdTimer = (id != 0 && g.HoveredIdPreviousFrame == id) ? (g.HoveredIdTimer + g.IO.DeltaTime) : 0.0f;
|
if (id != 0 && g.HoveredIdPreviousFrame != id)
|
||||||
|
g.HoveredIdTimer = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiID ImGui::GetHoveredID()
|
ImGuiID ImGui::GetHoveredID()
|
||||||
@ -3897,6 +3898,8 @@ void ImGui::NewFrame()
|
|||||||
// Clear reference to active widget if the widget isn't alive anymore
|
// Clear reference to active widget if the widget isn't alive anymore
|
||||||
if (!g.HoveredIdPreviousFrame)
|
if (!g.HoveredIdPreviousFrame)
|
||||||
g.HoveredIdTimer = 0.0f;
|
g.HoveredIdTimer = 0.0f;
|
||||||
|
if (g.HoveredId)
|
||||||
|
g.HoveredIdTimer += g.IO.DeltaTime;
|
||||||
g.HoveredIdPreviousFrame = g.HoveredId;
|
g.HoveredIdPreviousFrame = g.HoveredId;
|
||||||
g.HoveredId = 0;
|
g.HoveredId = 0;
|
||||||
g.HoveredIdAllowOverlap = false;
|
g.HoveredIdAllowOverlap = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user