mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 03:58:47 +02:00
Added IsItemActivated() as an extension to the IsItemDeactivated/IsItemDeactivatedAfterEdit functions which are useful to implement variety of undo patterns. (#820, #956, #1875)
This commit is contained in:
12
imgui.cpp
12
imgui.cpp
@ -4215,6 +4215,18 @@ bool ImGui::IsItemActive()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ImGui::IsItemActivated()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.ActiveId)
|
||||
{
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
if (g.ActiveId == window->DC.LastItemId && g.ActiveIdPreviousFrame != window->DC.LastItemId)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ImGui::IsItemDeactivated()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
Reference in New Issue
Block a user