Internals: extracted a more reusable BeginViewportSideBar() out of BeginMainMenuBar(). (#3966, #3518)

Complement ca34c81c in docking branch which removed assumption that we can't tell size ahead of Begin().
This commit is contained in:
ocornut
2021-03-25 16:16:48 +01:00
parent aa5431fde2
commit a58271c079
3 changed files with 66 additions and 41 deletions

View File

@ -10566,9 +10566,9 @@ static void ImGui::UpdateViewportsNewFrame()
ImGuiViewportP* viewport = g.Viewports[n];
// Lock down space taken by menu bars and status bars, reset the offset for fucntions like BeginMainMenuBar() to alter them again.
viewport->WorkOffsetMin = viewport->CurrWorkOffsetMin;
viewport->WorkOffsetMax = viewport->CurrWorkOffsetMax;
viewport->CurrWorkOffsetMin = viewport->CurrWorkOffsetMax = ImVec2(0.0f, 0.0f);
viewport->WorkOffsetMin = viewport->BuildWorkOffsetMin;
viewport->WorkOffsetMax = viewport->BuildWorkOffsetMax;
viewport->BuildWorkOffsetMin = viewport->BuildWorkOffsetMax = ImVec2(0.0f, 0.0f);
viewport->UpdateWorkRect();
}
}