Skip to content

Commit

Permalink
InvisibleButton: Added an assert to catch common type of passing zero…
Browse files Browse the repository at this point in the history
…-sized dimensions. (#1983)
  • Loading branch information
ocornut committed Jul 30, 2018
1 parent 067edd0 commit f88bf9c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8332,6 +8332,9 @@ bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg)
if (window->SkipItems)
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);
ImVec2 size = CalcItemSize(size_arg, 0.0f, 0.0f);
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
Expand Down

0 comments on commit f88bf9c

Please sign in to comment.