mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-06 04:58:47 +02:00
Window: Fixed position not being clamped while auto-resizing (#5843)
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user