From 45499b8f2f9e95f6e4b4adfe0d29219761ae9378 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 26 Aug 2020 20:18:54 +0200 Subject: [PATCH] Window: Fixed using non-zero pivot in SetNextWindowPos() when the window is collapsed. (#3433) --- docs/CHANGELOG.txt | 3 ++- imgui.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index d5d601f9..6543dacf 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -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 diff --git a/imgui.cpp b/imgui.cpp index 5918e087..922cbd0e 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -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)