mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 05:19:02 +08:00
Window: Fixed contents region being off by WindowBorderSize amount on the right when scrollbar is active.
This commit is contained in:
parent
5d799d76ea
commit
61d92580aa
@ -58,6 +58,7 @@ Other Changes:
|
||||
One of the noticeable minor side effect was that navigating menus would have had a tendency to disable
|
||||
highlight from parent menu items earlier than necessary while approaching the child menu.
|
||||
- Window: Close button is horizontally aligned with style.FramePadding.x.
|
||||
- Window: Fixed contents region being off by WindowBorderSize amount on the right when scrollbar is active.
|
||||
- GetMouseDragDelta(): also returns the delta on the mouse button released frame. (#2419)
|
||||
- GetMouseDragDelta(): verify that mouse positions are valid otherwise returns zero.
|
||||
- Inputs: Also add support for horizontal scroll with Shift+Mouse Wheel. (#2424, #1463) [@LucaRood]
|
||||
|
16
imgui.cpp
16
imgui.cpp
@ -5414,8 +5414,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
// FIXME: window->ContentsRegionRect.Max is currently very misleading / partly faulty, but some BeginChild() patterns relies on it.
|
||||
window->ContentsRegionRect.Min.x = window->Pos.x - window->Scroll.x + window->WindowPadding.x;
|
||||
window->ContentsRegionRect.Min.y = window->Pos.y - window->Scroll.y + window->WindowPadding.y + window->TitleBarHeight() + window->MenuBarHeight();
|
||||
window->ContentsRegionRect.Max.x = window->Pos.x - window->Scroll.x - window->WindowPadding.x + (window->SizeContentsExplicit.x != 0.0f ? window->SizeContentsExplicit.x : (window->Size.x - window->ScrollbarSizes.x));
|
||||
window->ContentsRegionRect.Max.y = window->Pos.y - window->Scroll.y - window->WindowPadding.y + (window->SizeContentsExplicit.y != 0.0f ? window->SizeContentsExplicit.y : (window->Size.y - window->ScrollbarSizes.y));
|
||||
window->ContentsRegionRect.Max.x = window->Pos.x - window->Scroll.x - window->WindowPadding.x + (window->SizeContentsExplicit.x != 0.0f ? window->SizeContentsExplicit.x : (window->Size.x - window->ScrollbarSizes.x + window->WindowBorderSize));
|
||||
window->ContentsRegionRect.Max.y = window->Pos.y - window->Scroll.y - window->WindowPadding.y + (window->SizeContentsExplicit.y != 0.0f ? window->SizeContentsExplicit.y : (window->Size.y - window->ScrollbarSizes.y + window->WindowBorderSize));
|
||||
|
||||
// Setup drawing context
|
||||
// (NB: That term "drawing context / DC" lost its meaning a long time ago. Initially was meant to hold transient data only. Nowadays difference between window-> and window->DC-> is dubious.)
|
||||
@ -5517,10 +5517,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
}
|
||||
}
|
||||
|
||||
// Save clipped aabb so we can access it in constant-time in FindHoveredWindow()
|
||||
window->OuterRectClipped = window->Rect();
|
||||
window->OuterRectClipped.ClipWith(window->ClipRect);
|
||||
|
||||
// Pressing CTRL+C while holding on a window copy its content to the clipboard
|
||||
// This works but 1. doesn't handle multiple Begin/End pairs, 2. recursing into another Begin/End pair - so we need to work that out and add better logging scope.
|
||||
// Maybe we can support CTRL+C on every element?
|
||||
@ -5530,13 +5526,17 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
LogToClipboard();
|
||||
*/
|
||||
|
||||
// Save clipped aabb so we can access it in constant-time in FindHoveredWindow()
|
||||
window->OuterRectClipped = window->Rect();
|
||||
window->OuterRectClipped.ClipWith(window->ClipRect);
|
||||
|
||||
// Inner rectangle
|
||||
// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame
|
||||
// Note that if our window is collapsed we will end up with an inverted (~null) clipping rectangle which is the correct behavior.
|
||||
window->InnerMainRect.Min.x = title_bar_rect.Min.x + window->WindowBorderSize;
|
||||
window->InnerMainRect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize);
|
||||
window->InnerMainRect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x - window->WindowBorderSize;
|
||||
window->InnerMainRect.Max.y = window->Pos.y + window->Size.y - window->ScrollbarSizes.y - window->WindowBorderSize;
|
||||
window->InnerMainRect.Max.x = window->Pos.x + window->Size.x - ImMax(window->ScrollbarSizes.x, window->WindowBorderSize);
|
||||
window->InnerMainRect.Max.y = window->Pos.y + window->Size.y - ImMax(window->ScrollbarSizes.y, window->WindowBorderSize);
|
||||
//window->DrawList->AddRect(window->InnerRect.Min, window->InnerRect.Max, IM_COL32_WHITE);
|
||||
|
||||
// Inner clipping rectangle
|
||||
|
Loading…
Reference in New Issue
Block a user