@ -1983,7 +1983,7 @@ void ImGui::ItemSize(const ImVec2& size, float text_offset_y)
window - > DC . CursorPosPrevLine = ImVec2 ( window - > DC . CursorPos . x + size . x , window - > DC . CursorPos . y ) ;
window - > DC . CursorPos = ImVec2 ( ( float ) ( int ) ( window - > Pos . x + window - > DC . IndentX + window - > DC . ColumnsOffsetX ) , ( float ) ( int ) ( window - > DC . CursorPos . y + line_height + g . Style . ItemSpacing . y ) ) ;
window - > DC . CursorMaxPos . x = ImMax ( window - > DC . CursorMaxPos . x , window - > DC . CursorPosPrevLine . x ) ;
window - > DC . CursorMaxPos . y = ImMax ( window - > DC . CursorMaxPos . y , window - > DC . CursorPos . y ) ;
window - > DC . CursorMaxPos . y = ImMax ( window - > DC . CursorMaxPos . y , window - > DC . CursorPos . y - g . Style . ItemSpacing . y ) ;
//if (g.IO.KeyAlt) window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, IM_COL32(255,0,0,255), 4); // [DEBUG]
window - > DC . PrevLineHeight = line_height ;
@ -4146,18 +4146,17 @@ static ImVec2 CalcSizeAutoFit(ImGuiWindow* window)
if ( ( flags & ImGuiWindowFlags_Tooltip ) ! = 0 )
{
// Tooltip always resize. We keep the spacing symmetric on both axises for aesthetic purpose.
size_auto_fit = window - > SizeContents + window - > WindowPadding - ImVec2 ( 0.0f , style . ItemSpacing . y ) ;
size_auto_fit = window - > SizeContents ;
}
else
{
// Handling case of auto fit window not fitting on the screen (on either axis): we are growing the size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than DisplaySize-WindowPadding.
size_auto_fit = ImClamp ( window - > SizeContents + window - > WindowPadding , style . WindowMinSize , ImMax ( style . WindowMinSize , g . IO . DisplaySize - g . Style . DisplaySafeAreaPadding ) ) ;
size_auto_fit = ImClamp ( window - > SizeContents , style . WindowMinSize , ImMax ( style . WindowMinSize , g . IO . DisplaySize - g . Style . DisplaySafeAreaPadding ) ) ;
ImVec2 size_auto_fit_after_constraint = CalcSizeFullWithConstraint ( window , size_auto_fit ) ;
if ( size_auto_fit_after_constraint . x < window - > SizeContents . x & & ! ( flags & ImGuiWindowFlags_NoScrollbar ) & & ( flags & ImGuiWindowFlags_HorizontalScrollbar ) )
size_auto_fit . y + = style . ScrollbarSize ;
if ( size_auto_fit_after_constraint . y < window - > SizeContents . y & & ! ( flags & ImGuiWindowFlags_NoScrollbar ) )
size_auto_fit . x + = style . ScrollbarSize ;
size_auto_fit . y = ImMax ( size_auto_fit . y - style . ItemSpacing . y , 0.0f ) ;
}
return size_auto_fit ;
}
@ -4364,6 +4363,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// Update contents size from last frame for auto-fitting (unless explicitly specified)
window - > SizeContents . x = ( float ) ( int ) ( ( window - > SizeContentsExplicit . x ! = 0.0f ) ? window - > SizeContentsExplicit . x : ( ( window_is_new ? 0.0f : window - > DC . CursorMaxPos . x - window - > Pos . x ) + window - > Scroll . x ) ) ;
window - > SizeContents . y = ( float ) ( int ) ( ( window - > SizeContentsExplicit . y ! = 0.0f ) ? window - > SizeContentsExplicit . y : ( ( window_is_new ? 0.0f : window - > DC . CursorMaxPos . y - window - > Pos . y ) + window - > Scroll . y ) ) ;
window - > SizeContents + = window - > WindowPadding ;
// Hide popup/tooltip window when first appearing while we measure size (because we recycle them)
if ( window - > HiddenFrames > 0 )
@ -4430,10 +4430,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// Update scrollbar status (based on the Size that was effective during last frame or the auto-resized Size). We need to do this before manual resize (below) is effective.
if ( ! window - > Collapsed )
{
window - > ScrollbarY = ( flags & ImGuiWindowFlags_AlwaysVerticalScrollbar ) | | ( ( window - > SizeContents . y > window - > SizeFull . y + style . ItemSpacing . y ) & & ! ( flags & ImGuiWindowFlags_NoScrollbar ) ) ;
window - > ScrollbarY = ( flags & ImGuiWindowFlags_AlwaysVerticalScrollbar ) | | ( ( window - > SizeContents . y > window - > SizeFull . y ) & & ! ( flags & ImGuiWindowFlags_NoScrollbar ) ) ;
window - > ScrollbarX = ( flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar ) | | ( ( window - > SizeContents . x > window - > SizeFull . x - ( window - > ScrollbarY ? style . ScrollbarSize : 0.0f ) - window - > WindowPadding . x ) & & ! ( flags & ImGuiWindowFlags_NoScrollbar ) & & ( flags & ImGuiWindowFlags_HorizontalScrollbar ) ) ;
if ( window - > ScrollbarX & & ! window - > ScrollbarY )
window - > ScrollbarY = ( window - > SizeContents . y > window - > SizeFull . y + style . ItemSpacing. y - style . ScrollbarSize) & & ! ( flags & ImGuiWindowFlags_NoScrollbar ) ;
window - > ScrollbarY = ( window - > SizeContents . y > window - > SizeFull . y + style . ScrollbarSize) & & ! ( flags & ImGuiWindowFlags_NoScrollbar ) ;
window - > ScrollbarSizes = ImVec2 ( window - > ScrollbarY ? style . ScrollbarSize : 0.0f , window - > ScrollbarX ? style . ScrollbarSize : 0.0f ) ;
}
@ -10409,7 +10409,6 @@ void ImGui::EndGroup()
ImGuiGroupData & group_data = window - > DC . GroupStack . back ( ) ;
ImRect group_bb ( group_data . BackupCursorPos , window - > DC . CursorMaxPos ) ;
group_bb . Max . y - = g . Style . ItemSpacing . y ; // Cancel out last vertical spacing because we are adding one ourselves.
group_bb . Max = ImMax ( group_bb . Min , group_bb . Max ) ;
window - > DC . CursorPos = group_data . BackupCursorPos ;