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,10 +624,15 @@ bool View::DrawImpl()
ImGui::TextUnformatted( "Go to frame" ); ImGui::TextUnformatted( "Go to frame" );
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
{
ImGui::SameLine(); ImGui::SameLine();
ImGui::Spacing(); ImGui::Spacing();
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text( ICON_FA_EYE " %-10s", TimeToString( m_vd.zvEnd - m_vd.zvStart ) ); const auto targetLabelSize = ImGui::CalcTextSize( "WWWWWWW" ).x;
auto cx = ImGui::GetCursorPosX();
ImGui::Text( ICON_FA_EYE " %s", TimeToString( m_vd.zvEnd - m_vd.zvStart ) );
if( ImGui::IsItemHovered() ) if( ImGui::IsItemHovered() )
{ {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
@ -635,7 +640,11 @@ bool View::DrawImpl()
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text( ICON_FA_DATABASE " %-10s", TimeToString( m_worker.GetLastTime() ) ); auto dx = ImGui::GetCursorPosX() - cx;
if( dx < targetLabelSize ) ImGui::SameLine( cx + targetLabelSize );
cx = ImGui::GetCursorPosX();
ImGui::Text( ICON_FA_DATABASE " %s", TimeToString( m_worker.GetLastTime() ) );
if( ImGui::IsItemHovered() ) if( ImGui::IsItemHovered() )
{ {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
@ -643,13 +652,22 @@ bool View::DrawImpl()
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text( ICON_FA_MEMORY " %-10s", MemSizeToString( memUsage ) ); 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() ) if( ImGui::IsItemHovered() )
{ {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImGui::Text( "Profiler memory usage" ); ImGui::Text( "Profiler memory usage" );
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
ImGui::SameLine();
dx = ImGui::GetCursorPosX() - cx;
if( dx < targetLabelSize ) ImGui::SameLine( cx + targetLabelSize );
ImGui::Spacing();
}
DrawNotificationArea(); DrawNotificationArea();
m_frameHover = -1; m_frameHover = -1;