diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 54003e9d..faec74e4 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -3375,8 +3375,7 @@ void View::DrawMessages() ImGui::PushID( v ); if( ImGui::Selectable( TimeToString( v->time - m_worker.GetFrameBegin( 0 ) ), m_msgHighlight == v, ImGuiSelectableFlags_SpanAllColumns ) ) { - const auto hr = std::max( 1, ( m_zvEnd - m_zvStart ) / 2 ); - ZoomToRange( v->time - hr, v->time + hr ); + CenterAtTime( v->time ); } ImGui::PopID(); ImGui::NextColumn(); @@ -5577,6 +5576,12 @@ void View::ZoomToNextFrame() ZoomToRange( fbegin, fend ); } +void View::CenterAtTime( int64_t t ) +{ + const auto hr = std::max( 1, ( m_zvEnd - m_zvStart ) / 2 ); + ZoomToRange( t - hr, t + hr ); +} + void View::ShowZoneInfo( const ZoneEvent& ev ) { if( m_zoneInfoWindow ) diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 8b62a697..5e0de331 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -105,6 +105,7 @@ private: void ZoomToRange( int64_t start, int64_t end ); void ZoomToPrevFrame(); void ZoomToNextFrame(); + void CenterAtTime( int64_t t ); void ShowZoneInfo( const ZoneEvent& ev ); void ShowZoneInfo( const GpuEvent& ev, uint64_t thread );