Răsfoiți Sursa

Fixed IsItemDeactivatedAfterEdit() signal being broken for Checkbox(), RadioButton(), Selectable(). (#8370)

Item is already made inactive at the time of calling MarkItemEdited().
Fix a604d4f71
ocornut 7 luni în urmă
părinte
comite
6265339995
2 a modificat fișierele cu 6 adăugiri și 0 ștergeri
  1. 3 0
      docs/CHANGELOG.txt
  2. 3 0
      imgui.cpp

+ 3 - 0
docs/CHANGELOG.txt

@@ -43,6 +43,9 @@ Breaking changes:
 
 
 Other changes:
 Other changes:
 
 
+- Fixed IsItemDeactivatedAfterEdit() signal being broken for Checkbox(), Selectable(). (#8370)
+  Regression from 2025/01/13.
+
 
 
 -----------------------------------------------------------------------
 -----------------------------------------------------------------------
  VERSION 1.91.8 (Released 2025-01-31)
  VERSION 1.91.8 (Released 2025-01-31)

+ 3 - 0
imgui.cpp

@@ -4440,8 +4440,11 @@ void ImGui::MarkItemEdited(ImGuiID id)
         return;
         return;
     if (g.ActiveId == id || g.ActiveId == 0)
     if (g.ActiveId == id || g.ActiveId == 0)
     {
     {
+        // FIXME: Can't we fully rely on LastItemData yet?
         g.ActiveIdHasBeenEditedThisFrame = true;
         g.ActiveIdHasBeenEditedThisFrame = true;
         g.ActiveIdHasBeenEditedBefore = true;
         g.ActiveIdHasBeenEditedBefore = true;
+        if (g.DeactivatedItemData.ID == id)
+            g.DeactivatedItemData.HasBeenEditedBefore = true;
     }
     }
 
 
     // We accept a MarkItemEdited() on drag and drop targets (see https://github.com/ocornut/imgui/issues/1875#issuecomment-978243343)
     // We accept a MarkItemEdited() on drag and drop targets (see https://github.com/ocornut/imgui/issues/1875#issuecomment-978243343)