From 17d3c202ac4cd3c5938beb95031280515eae23ff Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 2 Mar 2016 21:46:23 +0100 Subject: [PATCH] BeginChild()/EndChild() fixed incorrect layout to allow widgets submitted after an auto-fit child wnidow (#540) --- imgui.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 5f54691e..17ca5984 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3382,12 +3382,11 @@ void ImGui::EndChild() else { // When using auto-filling child window, we don't provide full width/height to ItemSize so that it doesn't feed back into automatic size-fitting. - ImGuiState& g = *GImGui; ImVec2 sz = ImGui::GetWindowSize(); - if (window->Flags & ImGuiWindowFlags_ChildWindowAutoFitX) // Arbitrary minimum zeroish child size of 4.0f - sz.x = ImMax(4.0f, sz.x - g.Style.WindowPadding.x); + if (window->Flags & ImGuiWindowFlags_ChildWindowAutoFitX) // 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->Flags & ImGuiWindowFlags_ChildWindowAutoFitY) - sz.y = ImMax(4.0f, sz.y - g.Style.WindowPadding.y); + sz.y = ImMax(4.0f, sz.y); ImGui::End();