Fixed clipping of child windows within parent not taking account of childouter clipping boundaries (including scrollbar, etc.) (#506)

This commit is contained in:
ocornut 2016-01-25 20:55:34 +00:00
parent 005b897d7d
commit 3ee50af57e

View File

@ -4071,7 +4071,6 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
clip_rect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + 0.5f + border_size; clip_rect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + 0.5f + border_size;
clip_rect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x - ImMax(border_size, window->WindowPadding.x*0.5f); clip_rect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x - ImMax(border_size, window->WindowPadding.x*0.5f);
clip_rect.Max.y = window->Pos.y + window->Size.y - border_size - window->ScrollbarSizes.y; clip_rect.Max.y = window->Pos.y + window->Size.y - border_size - window->ScrollbarSizes.y;
PushClipRect(clip_rect.Min, clip_rect.Max, true); PushClipRect(clip_rect.Min, clip_rect.Max, true);
// Clear 'accessed' flag last thing // Clear 'accessed' flag last thing
@ -4087,7 +4086,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
window->Collapsed = parent_window && parent_window->Collapsed; window->Collapsed = parent_window && parent_window->Collapsed;
if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0) if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
window->Collapsed |= (window->ClipRect.Min.x >= window->ClipRect.Max.x || window->ClipRect.Min.y >= window->ClipRect.Max.y); window->Collapsed |= (window->ClippedWindowRect.Min.x >= window->ClippedWindowRect.Max.x || window->ClippedWindowRect.Min.y >= window->ClippedWindowRect.Max.y);
// We also hide the window from rendering because we've already added its border to the command list. // We also hide the window from rendering because we've already added its border to the command list.
// (we could perform the check earlier in the function but it is simpler at this point) // (we could perform the check earlier in the function but it is simpler at this point)