mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 07:40:22 +01:00
Windows: Changed default ClipRect to extend to windows' left and right borders. (#3312, #7540, #3756, #6170, #6365)
This commit is contained in:
parent
0c9c12c1bb
commit
0b309471f2
@ -56,6 +56,12 @@ Breaking changes:
|
||||
|
||||
Other changes:
|
||||
|
||||
- Windows: Changed default ClipRect to extend to windows' left and right borders,
|
||||
instead of adding arbitrary WindowPadding.x * 0.5f space on left and right.
|
||||
That ClipRect half-padding was arbitrary/confusing and inconsistent with Y axis.
|
||||
It also made it harder to draw items covering whole window without pushing an
|
||||
extended ClipRect. Some items near windows left and right edge that used to be clipped
|
||||
may be partly more visible. (#3312, #7540, #3756, #6170, #6365)
|
||||
- Windows: Fixed subsequent Begin() append calls from setting last item information
|
||||
for title bar, making it impossible to use IsItemHovered() on a Begin()-to-append,
|
||||
and causing issue bypassing hover detection on collapsed windows. (#7506, #823)
|
||||
|
12
imgui.cpp
12
imgui.cpp
@ -6838,16 +6838,18 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
window->InnerRect.Max.y = window->Pos.y + window->Size.y - window->DecoOuterSizeY2;
|
||||
|
||||
// Inner clipping rectangle.
|
||||
// Will extend a little bit outside the normal work region.
|
||||
// This is to allow e.g. Selectable or CollapsingHeader or some separators to cover that space.
|
||||
// Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
|
||||
// - Extend a outside of normal work region up to borders.
|
||||
// - This is to allow e.g. Selectable or CollapsingHeader or some separators to cover that space.
|
||||
// - It also makes clipped items be more noticeable.
|
||||
// - And is consistent on both axis (prior to 2024/05/03 ClipRect used WindowPadding.x * 0.5f on left and right edge), see #3312
|
||||
// - Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
|
||||
// Note that if our window is collapsed we will end up with an inverted (~null) clipping rectangle which is the correct behavior.
|
||||
// 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 + ImMax(ImTrunc(window->WindowPadding.x * 0.5f), 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 - ImMax(ImTrunc(window->WindowPadding.x * 0.5f), window->WindowBorderSize));
|
||||
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);
|
||||
window->InnerClipRect.ClipWithFull(host_rect);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user