mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-12 00:14:20 +00:00
Added IsItemClicked() helper (#581)
This commit is contained in:
parent
ec6471ca87
commit
ac501102fc
2 changed files with 7 additions and 2 deletions
|
|
@ -1722,8 +1722,7 @@ bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id)
|
|||
ImGuiWindow* window = GetCurrentWindow();
|
||||
window->DC.LastItemID = id ? *id : 0;
|
||||
window->DC.LastItemRect = bb;
|
||||
window->DC.LastItemHoveredAndUsable = false;
|
||||
window->DC.LastItemHoveredRect = false;
|
||||
window->DC.LastItemHoveredAndUsable = window->DC.LastItemHoveredRect = false;
|
||||
if (IsClippedEx(bb, id, false))
|
||||
return false;
|
||||
|
||||
|
|
@ -3056,6 +3055,11 @@ bool ImGui::IsItemActive()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ImGui::IsItemClicked(int mouse_button)
|
||||
{
|
||||
return IsMouseClicked(mouse_button) && IsItemHovered();
|
||||
}
|
||||
|
||||
bool ImGui::IsAnyItemHovered()
|
||||
{
|
||||
return GImGui->HoveredId != 0 || GImGui->HoveredIdPreviousFrame != 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue