mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-22 15:46:35 +00:00
Window: Fixed position not being clamped while auto-resizing (#5843)
This commit is contained in:
parent
6e9dfe1de1
commit
90e9465fa5
@ -139,6 +139,8 @@ Other Changes:
|
||||
- Window: Fixed a potential crash when appending to a child window. (#5515, #3496, #4797) [@rokups]
|
||||
- Window: Fixed an issue where uncollapsed a window would show a scrollbar for a frame.
|
||||
- Window: Auto-fit size takes account of work rectangle (menu bars eating from viewport). (#5843)
|
||||
- Window: Fixed position not being clamped while auto-resizing (fixes appearing windows without
|
||||
.ini data from moving for a frame when using io.ConfigWindowsMoveFromTitleBarOnly). (#5843)
|
||||
- IO: Added ImGuiMod_Shortcut which is ImGuiMod_Super on Mac and ImGuiMod_Ctrl otherwise. (#456)
|
||||
- IO: Added ImGuiKey_MouseXXX aliases for mouse buttons/wheel so all operations done on ImGuiKey
|
||||
can apply to mouse data as well. (#4921)
|
||||
|
@ -5987,7 +5987,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
|
||||
return ret_auto_fit;
|
||||
}
|
||||
|
||||
static inline void ClampWindowRect(ImGuiWindow* window, const ImRect& visibility_rect)
|
||||
static inline void ClampWindowPos(ImGuiWindow* window, const ImRect& visibility_rect)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImVec2 size_for_clamping = window->Size;
|
||||
@ -6576,9 +6576,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
|
||||
// Clamp position/size so window stays visible within its viewport or monitor
|
||||
// Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing.
|
||||
if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
|
||||
if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow))
|
||||
if (viewport_rect.GetWidth() > 0.0f && viewport_rect.GetHeight() > 0.0f)
|
||||
ClampWindowRect(window, visibility_rect);
|
||||
ClampWindowPos(window, visibility_rect);
|
||||
window->Pos = ImFloor(window->Pos);
|
||||
|
||||
// Lock window rounding for the frame (so that altering them doesn't cause inconsistencies)
|
||||
|
Loading…
Reference in New Issue
Block a user