mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-26 13:37:00 +00:00
InvisibleButton() honor negative size consistently with other widgets that do so
This commit is contained in:
parent
90e5c97f13
commit
b803d284c3
@ -5083,13 +5083,14 @@ bool ImGui::SmallButton(const char* label)
|
|||||||
|
|
||||||
// Tip: use ImGui::PushID()/PopID() to push indices or pointers in the ID stack.
|
// Tip: use ImGui::PushID()/PopID() to push indices or pointers in the ID stack.
|
||||||
// Then you can keep 'str_id' empty or the same for all your buttons (instead of creating a string based on a non-string id)
|
// Then you can keep 'str_id' empty or the same for all your buttons (instead of creating a string based on a non-string id)
|
||||||
bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size)
|
bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const ImGuiID id = window->GetID(str_id);
|
const ImGuiID id = window->GetID(str_id);
|
||||||
|
ImVec2 size = CalcItemSize(size_arg, 0.0f, 0.0f);
|
||||||
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
|
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
|
||||||
ItemSize(bb);
|
ItemSize(bb);
|
||||||
if (!ItemAdd(bb, &id))
|
if (!ItemAdd(bb, &id))
|
||||||
|
Loading…
Reference in New Issue
Block a user