From 5ea6e80da155e45d7e94b917966adb85fe992e3c Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 15 Nov 2017 22:20:40 +0100 Subject: [PATCH] Make it possible to use SetNextWindowPos() on a child window. Useful internally. --- imgui.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index eef43a4f..f52505bf 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4293,7 +4293,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->SizeFull = CalcSizeFullWithConstraint(window, window->SizeFull); window->Size = window->Collapsed ? window->TitleBarRect().GetSize() : window->SizeFull; if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup)) + { + IM_ASSERT(window_size_set_by_api); // Submitted by BeginChild() window->Size = window->SizeFull; + } // SCROLLBAR STATUS @@ -4316,11 +4319,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->OrderWithinParent = parent_window->DC.ChildWindows.Size; parent_window->DC.ChildWindows.push_back(window); } - if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup)) - { - IM_ASSERT(window_size_set_by_api); // Submitted by BeginChild() + if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_pos_set_by_api) window->Pos = window->PosFloat = parent_window->DC.CursorPos; - } const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFrames == 0); if (window_pos_with_pivot)