mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
Merged a bit of code from Navigation branch to ease further merging (InnerRect is currently not required in the Master branch)
This commit is contained in:
parent
c432fcf2bb
commit
d42f6bb6cc
18
imgui.cpp
18
imgui.cpp
@ -4613,17 +4613,23 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
*/
|
||||
}
|
||||
|
||||
// Inner clipping rectangle
|
||||
// Inner rectangle and inner clipping 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 a null clipping rectangle which is the correct behavior.
|
||||
const ImRect title_bar_rect = window->TitleBarRect();
|
||||
const float border_size = window->BorderSize;
|
||||
// Force round to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
|
||||
window->InnerRect.Min.x = title_bar_rect.Min.x;
|
||||
window->InnerRect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight();
|
||||
window->InnerRect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x;
|
||||
window->InnerRect.Max.y = window->Pos.y + window->Size.y - window->ScrollbarSizes.y;
|
||||
//window->DrawList->AddRect(window->InnerRect.Min, window->InnerRect.Max, IM_COL32_WHITE);
|
||||
|
||||
// Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
|
||||
ImRect clip_rect;
|
||||
clip_rect.Min.x = ImFloor(0.5f + title_bar_rect.Min.x + ImMax(border_size, ImFloor(window->WindowPadding.x*0.5f)));
|
||||
clip_rect.Min.y = ImFloor(0.5f + title_bar_rect.Max.y + window->MenuBarHeight() + border_size);
|
||||
clip_rect.Max.x = ImFloor(0.5f + window->Pos.x + window->Size.x - window->ScrollbarSizes.x - ImMax(border_size, ImFloor(window->WindowPadding.x*0.5f)));
|
||||
clip_rect.Max.y = ImFloor(0.5f + window->Pos.y + window->Size.y - window->ScrollbarSizes.y - border_size);
|
||||
clip_rect.Min.x = ImFloor(0.5f + window->InnerRect.Min.x + ImMax(border_size, ImFloor(window->WindowPadding.x*0.5f)));
|
||||
clip_rect.Min.y = ImFloor(0.5f + window->InnerRect.Min.y + border_size);
|
||||
clip_rect.Max.x = ImFloor(0.5f + window->InnerRect.Max.x - ImMax(border_size, ImFloor(window->WindowPadding.x*0.5f)));
|
||||
clip_rect.Max.y = ImFloor(0.5f + window->InnerRect.Max.y - border_size);
|
||||
PushClipRect(clip_rect.Min, clip_rect.Max, true);
|
||||
|
||||
// Clear 'accessed' flag last thing
|
||||
|
@ -714,6 +714,7 @@ struct IMGUI_API ImGuiWindow
|
||||
ImVector<ImGuiID> IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack
|
||||
ImRect ClipRect; // = DrawList->clip_rect_stack.back(). Scissoring / clipping rectangle. x1, y1, x2, y2.
|
||||
ImRect WindowRectClipped; // = WindowRect just after setup in Begin(). == window->Rect() for root window.
|
||||
ImRect InnerRect;
|
||||
int LastFrameActive;
|
||||
float ItemWidthDefault;
|
||||
ImGuiSimpleColumns MenuColumns; // Simplified columns storage for menu items
|
||||
|
Loading…
Reference in New Issue
Block a user