Fixed using SetNextWindowPos() on a child window (which wasn't really documented) position the cursor as expected in the parent window, so there is no mismatch between the layout in parent and the position of the child window. Demo tweak and adding some child window stuff

This commit is contained in:
omar
2018-12-19 15:19:31 +01:00
parent 89ac0ea7c1
commit 6890e08bc5
4 changed files with 40 additions and 8 deletions

View File

@ -4152,6 +4152,10 @@ static bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size
child_window->ChildId = id;
child_window->AutoFitChildAxises = 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.
parent_window->DC.CursorPos = child_window->Pos;
// Process navigation-in immediately so NavInit can run on first frame
if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayerActiveMask != 0 || child_window->DC.NavHasScroll))
{