|
|
@@ -5416,9 +5416,27 @@ 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));
|
|
|
|
|
|
+ // 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 - ImMax(window->ScrollbarSizes.x, window->WindowBorderSize);
|
|
|
+ window->InnerMainRect.Max.y = window->Pos.y + window->Size.y - ImMax(window->ScrollbarSizes.y, window->WindowBorderSize);
|
|
|
+
|
|
|
+ // Inner clipping rectangle
|
|
|
+ // Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
|
|
|
+ window->InnerClipRect.Min.x = ImFloor(0.5f + window->InnerMainRect.Min.x + ImMax(0.0f, ImFloor(window->WindowPadding.x * 0.5f - window->WindowBorderSize)));
|
|
|
+ window->InnerClipRect.Min.y = ImFloor(0.5f + window->InnerMainRect.Min.y);
|
|
|
+ window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerMainRect.Max.x - ImMax(0.0f, ImFloor(window->WindowPadding.x * 0.5f - window->WindowBorderSize)));
|
|
|
+ window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerMainRect.Max.y);
|
|
|
// 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.)
|
|
|
window->DC.Indent.x = 0.0f + window->WindowPadding.x - window->Scroll.x;
|
|
|
@@ -5519,10 +5537,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?
|
|
|
@@ -5532,22 +5546,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
LogToClipboard();
|
|
|
*/
|
|
|
|
|
|
- // 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->DrawList->AddRect(window->InnerRect.Min, window->InnerRect.Max, IM_COL32_WHITE);
|
|
|
-
|
|
|
- // Inner clipping rectangle
|
|
|
- // Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
|
|
|
- window->InnerClipRect.Min.x = ImFloor(0.5f + window->InnerMainRect.Min.x + ImMax(0.0f, ImFloor(window->WindowPadding.x*0.5f - window->WindowBorderSize)));
|
|
|
- window->InnerClipRect.Min.y = ImFloor(0.5f + window->InnerMainRect.Min.y);
|
|
|
- window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerMainRect.Max.x - ImMax(0.0f, ImFloor(window->WindowPadding.x*0.5f - window->WindowBorderSize)));
|
|
|
- window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerMainRect.Max.y);
|
|
|
-
|
|
|
// We fill last item data based on Title Bar/Tab, in order for IsItemHovered() and IsItemActive() to be usable after Begin().
|
|
|
// This is useful to allow creating context menus on title bar only, etc.
|
|
|
window->DC.LastItemId = window->MoveId;
|
|
|
@@ -8103,14 +8101,14 @@ static float ImGui::NavUpdatePageUpPageDown(int allowed_dir_flags)
|
|
|
{
|
|
|
// Fallback manual-scroll when window has no navigable item
|
|
|
if (IsKeyPressed(g.IO.KeyMap[ImGuiKey_PageUp], true))
|
|
|
- SetWindowScrollY(window, window->Scroll.y - window->InnerClipRect.GetHeight());
|
|
|
+ SetWindowScrollY(window, window->Scroll.y - window->InnerMainRect.GetHeight());
|
|
|
else if (IsKeyPressed(g.IO.KeyMap[ImGuiKey_PageDown], true))
|
|
|
- SetWindowScrollY(window, window->Scroll.y + window->InnerClipRect.GetHeight());
|
|
|
+ SetWindowScrollY(window, window->Scroll.y + window->InnerMainRect.GetHeight());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
const ImRect& nav_rect_rel = window->NavRectRel[g.NavLayer];
|
|
|
- const float page_offset_y = ImMax(0.0f, window->InnerClipRect.GetHeight() - window->CalcFontSize() * 1.0f + nav_rect_rel.GetHeight());
|
|
|
+ const float page_offset_y = ImMax(0.0f, window->InnerMainRect.GetHeight() - window->CalcFontSize() * 1.0f + nav_rect_rel.GetHeight());
|
|
|
float nav_scoring_rect_offset_y = 0.0f;
|
|
|
if (IsKeyPressed(g.IO.KeyMap[ImGuiKey_PageUp], true))
|
|
|
{
|