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)
This commit is contained in:
omar 2019-11-26 20:25:54 +01:00
parent 813e0c18e6
commit 1c3a9c8e74

View File

@ -13278,7 +13278,6 @@ void ImGui::DockNodeTreeUpdatePosSize(ImGuiDockNode* node, ImVec2 pos, ImVec2 si
{ {
// During the regular dock node update we write to all nodes. // 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. // '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); const bool write_to_node = (only_write_to_marked_nodes == false) || (node->MarkedForPosSizeWrite);
if (write_to_node) if (write_to_node)
{ {
@ -14223,9 +14222,10 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open)
return; return;
} }
// We can have zero-sized nodes (e.g. children of a small-size dockspace)
IM_ASSERT(node->HostWindow); IM_ASSERT(node->HostWindow);
IM_ASSERT(node->IsLeafNode()); 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; node->State = ImGuiDockNodeState_HostWindowVisible;
// Undock if we are submitted earlier than the host window // Undock if we are submitted earlier than the host window