mirror of
https://github.com/ocornut/imgui.git
synced 2025-11-13 05:48:42 +00:00
Windows: Changed default ClipRect to extend to windows' left and right borders. (#3312, #7540, #3756, #6170, #6365)
This commit is contained in:
@@ -56,6 +56,12 @@ Breaking changes:
|
|||||||
|
|
||||||
Other 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
|
- 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,
|
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)
|
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;
|
window->InnerRect.Max.y = window->Pos.y + window->Size.y - window->DecoOuterSizeY2;
|
||||||
|
|
||||||
// Inner clipping rectangle.
|
// Inner clipping rectangle.
|
||||||
// Will extend a little bit outside the normal work region.
|
// - 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.
|
// - 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.
|
// - 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.
|
// 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:
|
// Affected by window/frame border size. Used by:
|
||||||
// - Begin() initial clip rect
|
// - Begin() initial clip rect
|
||||||
float top_border_size = (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize);
|
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.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.Max.y = ImFloor(0.5f + window->InnerRect.Max.y - window->WindowBorderSize);
|
||||||
window->InnerClipRect.ClipWithFull(host_rect);
|
window->InnerClipRect.ClipWithFull(host_rect);
|
||||||
|
|
||||||
|
|||||||
2
imgui.h
2
imgui.h
@@ -28,7 +28,7 @@
|
|||||||
// Library Version
|
// Library Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||||
#define IMGUI_VERSION "1.90.6 WIP"
|
#define IMGUI_VERSION "1.90.6 WIP"
|
||||||
#define IMGUI_VERSION_NUM 19053
|
#define IMGUI_VERSION_NUM 19054
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user