Fix popup positioning, broken by 84e6fe4. (#3991, #3982)

This commit is contained in:
ocornut 2021-03-31 19:09:08 +02:00
parent 6ddcdbe3e8
commit 65cd14502c

View File

@ -6226,6 +6226,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// UPDATE CONTENTS SIZE, UPDATE HIDDEN STATUS // UPDATE CONTENTS SIZE, UPDATE HIDDEN STATUS
// Update contents size from last frame for auto-fitting (or use explicit size) // Update contents size from last frame for auto-fitting (or use explicit size)
const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFramesCannotSkipItems > 0);
CalcWindowContentSizes(window, &window->ContentSize, &window->ContentSizeIdeal); CalcWindowContentSizes(window, &window->ContentSize, &window->ContentSizeIdeal);
// FIXME: These flags are decremented before they are used. This means that in order to have these fields produce their intended behaviors // FIXME: These flags are decremented before they are used. This means that in order to have these fields produce their intended behaviors
@ -6367,7 +6368,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window->Pos = parent_window->DC.CursorPos; window->Pos = parent_window->DC.CursorPos;
} }
const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFramesCannotSkipItems > 0);
const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFramesCannotSkipItems == 0); const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFramesCannotSkipItems == 0);
if (window_pos_with_pivot) if (window_pos_with_pivot)
SetWindowPos(window, window->SetWindowPosVal - window->Size * 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)