mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-14 17:07:01 +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;
|
||||
g.HoveredId = id;
|
||||
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()
|
||||
@ -3897,6 +3898,8 @@ void ImGui::NewFrame()
|
||||
// Clear reference to active widget if the widget isn't alive anymore
|
||||
if (!g.HoveredIdPreviousFrame)
|
||||
g.HoveredIdTimer = 0.0f;
|
||||
if (g.HoveredId)
|
||||
g.HoveredIdTimer += g.IO.DeltaTime;
|
||||
g.HoveredIdPreviousFrame = g.HoveredId;
|
||||
g.HoveredId = 0;
|
||||
g.HoveredIdAllowOverlap = false;
|
||||
|
Loading…
Reference in New Issue
Block a user