Try to make the top bar labels fit in their space.

This commit is contained in:
Bartosz Taudul 2024-05-04 14:07:14 +02:00
parent 4420f5863f
commit 6199b2f883
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -976,8 +976,8 @@ bool View::DrawImpl()
ImGui::SameLine(); ImGui::SameLine();
ImGui::Spacing(); ImGui::Spacing();
ImGui::SameLine(); ImGui::SameLine();
const auto targetLabelSize = ImGui::CalcTextSize( "WWWWWWW" ).x;
auto targetLabelSize = ImGui::CalcTextSize( ICON_FA_EYE " 12345.67 ms" ).x;
auto cx = ImGui::GetCursorPosX(); auto cx = ImGui::GetCursorPosX();
ImGui::Text( ICON_FA_EYE " %s", TimeToString( m_vd.zvEnd - m_vd.zvStart ) ); ImGui::Text( ICON_FA_EYE " %s", TimeToString( m_vd.zvEnd - m_vd.zvStart ) );
TooltipIfHovered( "View span" ); TooltipIfHovered( "View span" );
@ -1010,6 +1010,7 @@ bool View::DrawImpl()
dx = ImGui::GetCursorPosX() - cx; dx = ImGui::GetCursorPosX() - cx;
if( dx < targetLabelSize ) ImGui::SameLine( cx + targetLabelSize ); if( dx < targetLabelSize ) ImGui::SameLine( cx + targetLabelSize );
targetLabelSize = ImGui::CalcTextSize( ICON_FA_MEMORY " 1234.56 MB (123.45 %%)" ).x;
cx = ImGui::GetCursorPosX(); cx = ImGui::GetCursorPosX();
ImGui::Text( ICON_FA_MEMORY " %s", MemSizeToString( memUsage ) ); ImGui::Text( ICON_FA_MEMORY " %s", MemSizeToString( memUsage ) );
TooltipIfHovered( "Profiler memory usage" ); TooltipIfHovered( "Profiler memory usage" );