mirror of
https://github.com/ocornut/imgui.git
synced 2025-01-18 01:06:45 +01:00
InvisibleButton: Added an assert to catch common type of passing zero-sized dimensions. (#1983)
This commit is contained in:
parent
067edd09f9
commit
f88bf9cea3
@ -8332,6 +8332,9 @@ bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg)
|
|||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Cannot use zero-size for InvisibleButton(). Unlike Button() there is not way to fallback using the label size.
|
||||||
|
IM_ASSERT(size_arg.x != 0.0f && size_arg.y != 0.0f);
|
||||||
|
|
||||||
const ImGuiID id = window->GetID(str_id);
|
const ImGuiID id = window->GetID(str_id);
|
||||||
ImVec2 size = CalcItemSize(size_arg, 0.0f, 0.0f);
|
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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user