mirror of
https://github.com/ocornut/imgui.git
synced 2025-09-06 03:18:21 +00:00
Internals: ensure ButtonBehavior() is called with non 0 id.
This commit is contained in:
@@ -509,7 +509,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
|
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
// Alternate registration spot, for when caller didn't use ItemAdd()
|
// Alternate registration spot, for when caller didn't use ItemAdd()
|
||||||
if (id != 0 && g.LastItemData.ID != id)
|
if (g.LastItemData.ID != id)
|
||||||
IMGUI_TEST_ENGINE_ITEM_ADD(id, bb, NULL);
|
IMGUI_TEST_ENGINE_ITEM_ADD(id, bb, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -537,6 +537,8 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
const ImGuiID test_owner_id = (flags & ImGuiButtonFlags_NoTestKeyOwner) ? ImGuiKeyOwner_Any : id;
|
const ImGuiID test_owner_id = (flags & ImGuiButtonFlags_NoTestKeyOwner) ? ImGuiKeyOwner_Any : id;
|
||||||
if (hovered)
|
if (hovered)
|
||||||
{
|
{
|
||||||
|
IM_ASSERT(id != 0); // Lazily check inside rare path.
|
||||||
|
|
||||||
// Poll mouse buttons
|
// Poll mouse buttons
|
||||||
// - 'mouse_button_clicked' is generally carried into ActiveIdMouseButton when setting ActiveId.
|
// - 'mouse_button_clicked' is generally carried into ActiveIdMouseButton when setting ActiveId.
|
||||||
// - Technically we only need some values in one code path, but since this is gated by hovered test this is fine.
|
// - Technically we only need some values in one code path, but since this is gated by hovered test this is fine.
|
||||||
|
Reference in New Issue
Block a user