Make it possible to use SetNextWindowPos() on a child window. Useful internally.

This commit is contained in:
omar 2017-11-15 22:20:40 +01:00
parent 27fd1b913b
commit 5ea6e80da1

View File

@ -4293,7 +4293,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window->SizeFull = CalcSizeFullWithConstraint(window, window->SizeFull); window->SizeFull = CalcSizeFullWithConstraint(window, window->SizeFull);
window->Size = window->Collapsed ? window->TitleBarRect().GetSize() : window->SizeFull; window->Size = window->Collapsed ? window->TitleBarRect().GetSize() : window->SizeFull;
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup)) if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup))
{
IM_ASSERT(window_size_set_by_api); // Submitted by BeginChild()
window->Size = window->SizeFull; window->Size = window->SizeFull;
}
// SCROLLBAR STATUS // SCROLLBAR STATUS
@ -4316,11 +4319,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window->OrderWithinParent = parent_window->DC.ChildWindows.Size; window->OrderWithinParent = parent_window->DC.ChildWindows.Size;
parent_window->DC.ChildWindows.push_back(window); parent_window->DC.ChildWindows.push_back(window);
} }
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup)) if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_pos_set_by_api)
{
IM_ASSERT(window_size_set_by_api); // Submitted by BeginChild()
window->Pos = window->PosFloat = parent_window->DC.CursorPos; window->Pos = window->PosFloat = parent_window->DC.CursorPos;
}
const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFrames == 0); const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFrames == 0);
if (window_pos_with_pivot) if (window_pos_with_pivot)