|
@@ -5445,7 +5445,6 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
|
|
|
|
|
|
ImGuiWindow* child_window = g.CurrentWindow;
|
|
|
child_window->ChildId = id;
|
|
|
- child_window->AutoFitChildAxises = (ImS8)auto_fit_axises;
|
|
|
|
|
|
// Set the cursor to handle case where the user called SetNextWindowPos()+BeginChild() manually.
|
|
|
// While this is not really documented/defined, it seems that the expected thing to do.
|
|
@@ -5488,22 +5487,13 @@ void ImGui::EndChild()
|
|
|
IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() calls
|
|
|
|
|
|
g.WithinEndChild = true;
|
|
|
- if (window->BeginCount > 1)
|
|
|
- {
|
|
|
- End();
|
|
|
- }
|
|
|
- else
|
|
|
+ ImVec2 child_size = window->Size;
|
|
|
+ End();
|
|
|
+ if (window->BeginCount == 1)
|
|
|
{
|
|
|
- ImVec2 sz = window->Size;
|
|
|
- if (window->AutoFitChildAxises & (1 << ImGuiAxis_X)) // Arbitrary minimum zero-ish child size of 4.0f causes less trouble than a 0.0f
|
|
|
- sz.x = ImMax(4.0f, sz.x);
|
|
|
- if (window->AutoFitChildAxises & (1 << ImGuiAxis_Y))
|
|
|
- sz.y = ImMax(4.0f, sz.y);
|
|
|
- End();
|
|
|
-
|
|
|
ImGuiWindow* parent_window = g.CurrentWindow;
|
|
|
- ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);
|
|
|
- ItemSize(sz);
|
|
|
+ ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + child_size);
|
|
|
+ ItemSize(child_size);
|
|
|
if ((window->DC.NavLayersActiveMask != 0 || window->DC.NavWindowHasScrollY) && !(window->Flags & ImGuiWindowFlags_NavFlattened))
|
|
|
{
|
|
|
ItemAdd(bb, window->ChildId);
|