@ -2643,6 +2643,7 @@ static void RenderTextClipped(ImVec2 pos, const char* text, const char* text_end
// Align
// Align
if ( align & ImGuiAlign_Center ) pos . x = ImMax ( pos . x , ( pos . x + pos_max . x - text_size . x ) * 0.5f ) ;
if ( align & ImGuiAlign_Center ) pos . x = ImMax ( pos . x , ( pos . x + pos_max . x - text_size . x ) * 0.5f ) ;
else if ( align & ImGuiAlign_Right ) pos . x = ImMax ( pos . x , pos_max . x - text_size . x ) ;
else if ( align & ImGuiAlign_Right ) pos . x = ImMax ( pos . x , pos_max . x - text_size . x ) ;
if ( align & ImGuiAlign_VCenter ) pos . y = ImMax ( pos . y , ( pos . y + pos_max . y - text_size . y ) * 0.5f ) ;
// Render
// Render
window - > DrawList - > AddText ( g . Font , g . FontSize , pos , window - > Color ( ImGuiCol_Text ) , text , text_display_end , 0.0f , need_clipping ? clip_max : NULL ) ;
window - > DrawList - > AddText ( g . Font , g . FontSize , pos , window - > Color ( ImGuiCol_Text ) , text , text_display_end , 0.0f , need_clipping ? clip_max : NULL ) ;
@ -4888,9 +4889,7 @@ static bool ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
// Render
// Render
const ImU32 col = window - > Color ( ( hovered & & held ) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button ) ;
const ImU32 col = window - > Color ( ( hovered & & held ) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button ) ;
RenderFrame ( bb . Min , bb . Max , col , true , style . FrameRounding ) ;
RenderFrame ( bb . Min , bb . Max , col , true , style . FrameRounding ) ;
RenderTextClipped ( bb . Min , label , NULL , & label_size , bb . Max , NULL , ImGuiAlign_Center | ImGuiAlign_VCenter ) ;
const ImVec2 off = ImVec2 ( ImMax ( 0.0f , size . x - label_size . x ) * 0.5f , ImMax ( 0.0f , size . y - label_size . y ) * 0.5f ) ; // Center (only applies if we explicitly gave a size bigger than the text size, which isn't the common path)
RenderTextClipped ( bb . Min + off , label , NULL , & label_size , bb . Max ) ; // Render clip (only applies if we explicitly gave a size smaller than the text size, which isn't common)
// Automatically close popups
// Automatically close popups
if ( pressed & & ! ( flags & ImGuiButtonFlags_DontClosePopups ) & & ( window - > Flags & ImGuiWindowFlags_Popup ) )
if ( pressed & & ! ( flags & ImGuiButtonFlags_DontClosePopups ) & & ( window - > Flags & ImGuiWindowFlags_Popup ) )