瀏覽代碼

Active widgets is not clipped, so it can always release its active state (mentioned in #143)

Otherwise a change in layout moving active widget to a clipped region
may lock the active id.
ocornut 10 年之前
父節點
當前提交
16ddd796f3
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      imgui.cpp

+ 5 - 2
imgui.cpp

@@ -7265,8 +7265,11 @@ static bool ItemAdd(const ImRect& bb, const ImGuiID* id)
     window->DC.LastItemRect = bb;
     if (IsClipped(bb))
     {
-        window->DC.LastItemHoveredAndUsable = window->DC.LastItemHoveredRect = false;
-        return false;
+        if (!id || *id != GImGui->ActiveId)
+        {
+            window->DC.LastItemHoveredAndUsable = window->DC.LastItemHoveredRect = false;
+            return false;
+        }
     }
 
     // This is a sensible default, but widgets are free to override it after calling ItemAdd()