Disabled: items more consistently release active id if the active item got disabled. (#211) (amend 2952525)
diff --git a/imgui.cpp b/imgui.cpp
index 8ae49a8..fe96577 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -3234,6 +3234,9 @@
// When disabled we'll return false but still set HoveredId
if (g.CurrentItemFlags & ImGuiItemFlags_Disabled)
{
+ // Release active id if turning disabled
+ if (g.ActiveId == id)
+ ClearActiveID();
g.HoveredIdDisabled = true;
return false;
}
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp
index 48a01ea..f841018 100644
--- a/imgui_widgets.cpp
+++ b/imgui_widgets.cpp
@@ -611,10 +611,6 @@
}
}
- // Release active id if turning disabled
- if (g.ActiveId == id && (g.CurrentItemFlags & ImGuiItemFlags_Disabled))
- ClearActiveID();
-
// Process while held
bool held = false;
if (g.ActiveId == id)