Browse Source

Docking: Remove Size > 0.0f asserts added in 718e15c7 and 7c183dc6. (#2690, #2109, #2906)

In #2906 the zero input came from a minimized viewport, but even without it we cannot prevent DockNode size from eventually reaching zero as padding are taken from the starting size.
In a separate commit we'll however shortcut some of the existing codepath on zero-sized viewport to reduce the likehood of lossy side-effects (just like we don't call ClampWindowRect in Begin)
omar 5 years ago
parent
commit
1c3a9c8e74
1 changed files with 2 additions and 2 deletions
  1. 2 2
      imgui.cpp

+ 2 - 2
imgui.cpp

@@ -13278,7 +13278,6 @@ void ImGui::DockNodeTreeUpdatePosSize(ImGuiDockNode* node, ImVec2 pos, ImVec2 si
 {
     // During the regular dock node update we write to all nodes.
     // 'only_write_to_marked_nodes' is only set when turning a node visible mid-frame and we need its size right-away.
-    IM_ASSERT(size.x > 0.0f && size.y > 0.0f);
     const bool write_to_node = (only_write_to_marked_nodes == false) || (node->MarkedForPosSizeWrite);
     if (write_to_node)
     {
@@ -14223,9 +14222,10 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open)
         return;
     }
 
+    // We can have zero-sized nodes (e.g. children of a small-size dockspace)
     IM_ASSERT(node->HostWindow);
     IM_ASSERT(node->IsLeafNode());
-    IM_ASSERT(node->Size.x > 0.0f && node->Size.y > 0.0f);
+    IM_ASSERT(node->Size.x >= 0.0f && node->Size.y >= 0.0f);
     node->State = ImGuiDockNodeState_HostWindowVisible;
 
     // Undock if we are submitted earlier than the host window