mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Internals: clarified the code for ClampWindowRect().
As a side-effect, some rounding error may be neutralized however this isn't the intent. (#3309)
This commit is contained in:
parent
8ead38c100
commit
9c2a36f573
@ -5239,11 +5239,13 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
|
|||||||
return ret_auto_fit;
|
return ret_auto_fit;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ClampWindowRect(ImGuiWindow* window, const ImRect& rect, const ImVec2& padding)
|
static inline void ClampWindowRect(ImGuiWindow* window, const ImRect& viewport_rect, const ImVec2& padding)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImVec2 size_for_clamping = (g.IO.ConfigWindowsMoveFromTitleBarOnly && !(window->Flags & ImGuiWindowFlags_NoTitleBar)) ? ImVec2(window->Size.x, window->TitleBarHeight()) : window->Size;
|
ImVec2 size_for_clamping = window->Size;
|
||||||
window->Pos = ImMin(rect.Max - padding, ImMax(window->Pos + size_for_clamping, rect.Min + padding) - size_for_clamping);
|
if (g.IO.ConfigWindowsMoveFromTitleBarOnly && !(window->Flags & ImGuiWindowFlags_NoTitleBar))
|
||||||
|
size_for_clamping.y = window->TitleBarHeight();
|
||||||
|
window->Pos = ImClamp(window->Pos, viewport_rect.Min + padding - size_for_clamping, viewport_rect.Max - padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ImGui::RenderWindowOuterBorders(ImGuiWindow* window)
|
static void ImGui::RenderWindowOuterBorders(ImGuiWindow* window)
|
||||||
|
Loading…
Reference in New Issue
Block a user