Fix time span indicators visual jitter.

This commit is contained in:
Bartosz Taudul 2020-04-13 15:00:37 +02:00
parent a2c4f8c2d1
commit 2d25e969e9

View File

@ -624,31 +624,49 @@ bool View::DrawImpl()
ImGui::TextUnformatted( "Go to frame" ); ImGui::TextUnformatted( "Go to frame" );
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
ImGui::Text( ICON_FA_EYE " %-10s", TimeToString( m_vd.zvEnd - m_vd.zvStart ) );
if( ImGui::IsItemHovered() )
{ {
ImGui::BeginTooltip(); ImGui::SameLine();
ImGui::Text( "View span" ); ImGui::Spacing();
ImGui::EndTooltip(); ImGui::SameLine();
} const auto targetLabelSize = ImGui::CalcTextSize( "WWWWWWW" ).x;
ImGui::SameLine();
ImGui::Text( ICON_FA_DATABASE " %-10s", TimeToString( m_worker.GetLastTime() ) ); auto cx = ImGui::GetCursorPosX();
if( ImGui::IsItemHovered() ) ImGui::Text( ICON_FA_EYE " %s", TimeToString( m_vd.zvEnd - m_vd.zvStart ) );
{ if( ImGui::IsItemHovered() )
ImGui::BeginTooltip(); {
ImGui::Text( "Time span" ); ImGui::BeginTooltip();
ImGui::EndTooltip(); ImGui::Text( "View span" );
} ImGui::EndTooltip();
ImGui::SameLine(); }
ImGui::Text( ICON_FA_MEMORY " %-10s", MemSizeToString( memUsage ) ); ImGui::SameLine();
if( ImGui::IsItemHovered() ) auto dx = ImGui::GetCursorPosX() - cx;
{ if( dx < targetLabelSize ) ImGui::SameLine( cx + targetLabelSize );
ImGui::BeginTooltip();
ImGui::Text( "Profiler memory usage" ); cx = ImGui::GetCursorPosX();
ImGui::EndTooltip(); ImGui::Text( ICON_FA_DATABASE " %s", TimeToString( m_worker.GetLastTime() ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::Text( "Time span" );
ImGui::EndTooltip();
}
ImGui::SameLine();
dx = ImGui::GetCursorPosX() - cx;
if( dx < targetLabelSize ) ImGui::SameLine( cx + targetLabelSize );
cx = ImGui::GetCursorPosX();
ImGui::Text( ICON_FA_MEMORY " %s", MemSizeToString( memUsage ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::Text( "Profiler memory usage" );
ImGui::EndTooltip();
}
ImGui::SameLine();
dx = ImGui::GetCursorPosX() - cx;
if( dx < targetLabelSize ) ImGui::SameLine( cx + targetLabelSize );
ImGui::Spacing();
} }
DrawNotificationArea(); DrawNotificationArea();