Window: Fixed using non-zero pivot in SetNextWindowPos() when the window is collapsed. (#3433)

This commit is contained in:
ocornut 2020-08-26 20:18:54 +02:00
parent 8c80d533d9
commit 45499b8f2f
2 changed files with 3 additions and 2 deletions

View File

@ -37,6 +37,8 @@ HOW TO UPDATE?
Other Changes:
- Window: Fixed using non-zero pivot in SetNextWindowPos() when the window is collapsed. (#3433)
- Nav: Fixed navigation resuming on first visible item when using gamepad. [@rokups]
- InputText: Added selection helpers in ImGuiInputTextCallbackData().
- InputText: Added ImGuiInputTextFlags_CallbackEdit to modify internally owned buffer after an edit.
(note that InputText() already returns true on edit, the callback is useful mainly to manipulate the
@ -45,7 +47,6 @@ Other Changes:
It is a rather unusual or useless combination of features but no reason it shouldn't work!
- DragFloat, DragScalar: Fixed ImGuiSliderFlags_ClampOnInput not being honored in the special case
where v_min == v_max. (#3361)
- Nav: Fix navigation resuming on first visible item when using gamepad. [@rokups]
- BeginMenuBar: Fixed minor bug where CursorPosMax gets pushed to CursorPos prior to calling BeginMenuBar(),
so e.g. calling the function at the end of a window would often add +ItemSpacing.y to scrolling range.
- TreeNode, CollapsingHeader: Made clicking on arrow toggle toggle the open state on the Mouse Down event

View File

@ -5721,7 +5721,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFramesCannotSkipItems == 0);
if (window_pos_with_pivot)
SetWindowPos(window, window->SetWindowPosVal - window->SizeFull * window->SetWindowPosPivot, 0); // Position given a pivot (e.g. for centering)
SetWindowPos(window, window->SetWindowPosVal - window->Size * window->SetWindowPosPivot, 0); // Position given a pivot (e.g. for centering)
else if ((flags & ImGuiWindowFlags_ChildMenu) != 0)
window->Pos = FindBestWindowPosForPopup(window);
else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_just_appearing_after_hidden_for_resize)