@ -5980,12 +5980,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
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 + ImMin ( 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 + ImMin ( window - > ScrollbarSizes . y , window - > WindowBorderSize ) ) ) ;
// Save clipped aabb so we can access it in constant-time in FindHoveredWindow()
window - > OuterRectClipped = window - > Rect ( ) ;
if ( window - > DockIsActive )
window - > OuterRectClipped . Min . y + = window - > TitleBarHeight ( ) ;
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.
@ -5995,12 +5989,24 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
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
// Outer host rectangle for drawing background and borders
ImRect host_rect = ( ( flags & ImGuiWindowFlags_ChildWindow ) & & ! ( flags & ImGuiWindowFlags_Popup ) & & ! window_is_child_tooltip ) ? parent_window - > ClipRect : viewport_rect ;
// Save clipped aabb so we can access it in constant-time in FindHoveredWindow()
window - > OuterRectClipped = window - > Rect ( ) ;
if ( window - > DockIsActive )
window - > OuterRectClipped . Min . y + = window - > TitleBarHeight ( ) ;
window - > OuterRectClipped . ClipWith ( host_rect ) ;
// Inner work/clipping rectangle will extend a little bit outside the work region.
// 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.
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 ) ;
window - > InnerWorkRect . Min . x = ImFloor ( 0.5f + window - > InnerMainRect . Min . x + ImMax ( 0.0f , ImFloor ( window - > WindowPadding . x * 0.5f - window - > WindowBorderSize ) ) ) ;
window - > InnerWorkRect . Min . y = ImFloor ( 0.5f + window - > InnerMainRect . Min . y ) ;
window - > InnerWorkRect . Max . x = ImFloor ( 0.5f + window - > InnerMainRect . Max . x - ImMax ( 0.0f , ImFloor ( window - > WindowPadding . x * 0.5f - window - > WindowBorderSize ) ) ) ;
window - > InnerWorkRect . Max . y = ImFloor ( 0.5f + window - > InnerMainRect . Max . y ) ;
window - > InnerWorkRectClipped = window - > InnerWorkRect ;
window - > InnerWorkRectClipped . ClipWithFull ( host_rect ) ;
// DRAWING
@ -6008,10 +6014,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window - > DrawList - > Clear ( ) ;
window - > DrawList - > Flags = ( g . Style . AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0 ) | ( g . Style . AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0 ) ;
window - > DrawList - > PushTextureID ( g . Font - > ContainerAtlas - > TexID ) ;
if ( ( flags & ImGuiWindowFlags_ChildWindow ) & & ! ( flags & ImGuiWindowFlags_Popup ) & & ! window_is_child_tooltip )
PushClipRect ( parent_window - > ClipRect . Min , parent_window - > ClipRect . Max , true ) ;
else
PushClipRect ( viewport_rect . Min , viewport_rect . Max , true ) ;
PushClipRect ( host_rect . Min , host_rect . Max , false ) ;
// Draw modal or window list full viewport dimming background (for other viewports we'll render them in EndFrame)
const bool dim_bg_for_modal = ( flags & ImGuiWindowFlags_Modal ) & & window = = GetFrontMostPopupModal ( ) & & window - > HiddenFramesCannotSkipItems < = 0 ;
@ -6158,7 +6161,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
}
if ( ! ( flags & ImGuiWindowFlags_DockNodeHost ) )
PushClipRect ( window - > Inner ClipRect. Min , window - > InnerClipRect . Max , true ) ;
PushClipRect ( window - > Inner WorkRectClipped. Min , window - > InnerWorkRectClipped . Max , true ) ;
// Clear 'accessed' flag last thing (After PushClipRect which will set the flag. We want the flag to stay false when the default "Debug" window is unused)
if ( first_begin_of_the_frame )
@ -9325,7 +9328,7 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlag
window - > DC . CurrentColumns = columns ;
// Set state for first column
const float content_region_width = ( window - > SizeContentsExplicit . x ! = 0.0f ) ? ( window - > SizeContentsExplicit . x ) : ( window - > Inner Clip Rect. Max . x - window - > Pos . x ) ;
const float content_region_width = ( window - > SizeContentsExplicit . x ! = 0.0f ) ? ( window - > SizeContentsExplicit . x ) : ( window - > Inner Work Rect. Max . x - window - > Pos . x ) ;
columns - > OffMinX = window - > DC . Indent . x - g . Style . ItemSpacing . x ; // Lock our horizontal range
columns - > OffMaxX = ImMax ( content_region_width - window - > Scroll . x , columns - > OffMinX + 1.0f ) ;
columns - > HostCursorPosY = window - > DC . CursorPos . y ;
@ -14325,10 +14328,10 @@ void ImGui::ShowMetricsWindow(bool* p_open)
return ;
}
enum { RT_OuterRect , RT_OuterRectClipped , RT_InnerMainRect , RT_Inner ClipRect , RT_ContentsRegionRect , RT_ContentsFullRect } ;
enum { RT_OuterRect , RT_OuterRectClipped , RT_InnerMainRect , RT_Inner WorkRect, RT_InnerWorkRectClipped , RT_ContentsRegionRect , RT_ContentsFullRect } ;
static bool show_windows_begin_order = false ;
static bool show_windows_rects = false ;
static int show_windows_rect_type = RT_ ContentsRegion Rect;
static int show_windows_rect_type = RT_ InnerWork Rect;
static bool show_drawcmd_clip_rects = true ;
ImGuiIO & io = ImGui : : GetIO ( ) ;
@ -14560,7 +14563,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
ImGui : : Checkbox ( " Show windows rectangles " , & show_windows_rects ) ;
ImGui : : SameLine ( ) ;
ImGui : : SetNextItemWidth ( ImGui : : GetFontSize ( ) * 12 ) ;
show_windows_rects | = ImGui : : Combo ( " ##rects_type " , & show_windows_rect_type , " OuterRect \0 " " OuterRectClipped \0 " " InnerMainRect \0 " " Inner ClipRect \0 " " ContentsRegionRect \0 " ) ;
show_windows_rects | = ImGui : : Combo ( " ##rects_type " , & show_windows_rect_type , " OuterRect \0 " " OuterRectClipped \0 " " InnerMainRect \0 " " Inner WorkRect\0 " " InnerWorkRectClipped \0 " " ContentsRegionRect \0 " ) ;
ImGui : : Checkbox ( " Show clipping rectangle when hovering ImDrawCmd node " , & show_drawcmd_clip_rects ) ;
ImGui : : TreePop ( ) ;
}
@ -14579,7 +14582,8 @@ void ImGui::ShowMetricsWindow(bool* p_open)
if ( show_windows_rect_type = = RT_OuterRect ) { r = window - > Rect ( ) ; }
else if ( show_windows_rect_type = = RT_OuterRectClipped ) { r = window - > OuterRectClipped ; }
else if ( show_windows_rect_type = = RT_InnerMainRect ) { r = window - > InnerMainRect ; }
else if ( show_windows_rect_type = = RT_InnerClipRect ) { r = window - > InnerClipRect ; }
else if ( show_windows_rect_type = = RT_InnerWorkRect ) { r = window - > InnerWorkRect ; }
else if ( show_windows_rect_type = = RT_InnerWorkRectClipped ) { r = window - > InnerWorkRectClipped ; }
else if ( show_windows_rect_type = = RT_ContentsRegionRect ) { r = window - > ContentsRegionRect ; }
draw_list - > AddRect ( r . Min , r . Max , IM_COL32 ( 255 , 0 , 128 , 255 ) ) ;
}