From 2f49caaa6e00ef1219c7b7fba5eaa6a8537b8ef4 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 3 Mar 2023 22:12:33 +0100 Subject: [PATCH] Show only active time span in on-demand mode. --- server/TracyView.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 40b42610..fa74ad64 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -909,16 +909,25 @@ bool View::DrawImpl() auto dx = ImGui::GetCursorPosX() - cx; if( dx < targetLabelSize ) ImGui::SameLine( cx + targetLabelSize ); + const auto firstTime = m_worker.GetFirstTime(); + const auto lastTime = m_worker.GetLastTime(); cx = ImGui::GetCursorPosX(); - ImGui::Text( ICON_FA_DATABASE " %s", TimeToString( m_worker.GetLastTime() ) ); + ImGui::Text( ICON_FA_DATABASE " %s", TimeToString( lastTime - firstTime ) ); if( ImGui::IsItemHovered() ) { ImGui::BeginTooltip(); - ImGui::Text( "Time span" ); + if( firstTime == 0 ) + { + ImGui::Text( "Time span" ); + } + else + { + TextFocused( "Total time span:", TimeToString( lastTime ) ); + } ImGui::EndTooltip(); if( ImGui::IsItemClicked( 2 ) ) { - ZoomToRange( 0, m_worker.GetLastTime() ); + ZoomToRange( firstTime, lastTime ); } } ImGui::SameLine();