mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Windows: adjust default ClipRect to better match rendering of thick borders. (#7887, #7888 + #3312, #7540, #3756, #6170, #6365)
This commit is contained in:
parent
eb7201b902
commit
e471206b08
2 changed files with 11 additions and 4 deletions
12
imgui.cpp
12
imgui.cpp
|
|
@ -7066,10 +7066,14 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||
// Affected by window/frame border size. Used by:
|
||||
// - Begin() initial clip rect
|
||||
float top_border_size = (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize);
|
||||
window->InnerClipRect.Min.x = ImFloor(0.5f + window->InnerRect.Min.x + window->WindowBorderSize);
|
||||
window->InnerClipRect.Min.y = ImFloor(0.5f + window->InnerRect.Min.y + top_border_size);
|
||||
window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerRect.Max.x - window->WindowBorderSize);
|
||||
window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerRect.Max.y - window->WindowBorderSize);
|
||||
|
||||
// Try to match the fact that our border is drawn centered over the window rectangle, rather than inner.
|
||||
// This is why we do a *0.5f here. We don't currently even technically support large values for WindowBorderSize,
|
||||
// see e.g #7887 #7888, but may do after we move the window border to become an inner border (and then we can remove the 0.5f here).
|
||||
window->InnerClipRect.Min.x = ImFloor(0.5f + window->InnerRect.Min.x + window->WindowBorderSize * 0.5f);
|
||||
window->InnerClipRect.Min.y = ImFloor(0.5f + window->InnerRect.Min.y + top_border_size * 0.5f);
|
||||
window->InnerClipRect.Max.x = ImFloor(window->InnerRect.Max.x - window->WindowBorderSize * 0.5f);
|
||||
window->InnerClipRect.Max.y = ImFloor(window->InnerRect.Max.y - window->WindowBorderSize * 0.5f);
|
||||
window->InnerClipRect.ClipWithFull(host_rect);
|
||||
|
||||
// Default item width. Make it proportional to window size if window manually resizes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue