diff --git a/server/TracyView_Timeline.cpp b/server/TracyView_Timeline.cpp index 0b88fdd0..18241db6 100644 --- a/server/TracyView_Timeline.cpp +++ b/server/TracyView_Timeline.cpp @@ -324,9 +324,16 @@ void View::DrawTimeline() ImGui::SetNextWindowContentSize( ImVec2( 0, m_tc.GetHeight() ) ); ImGui::BeginChild( "##zoneWin", ImVec2( ImGui::GetContentRegionAvail().x, ImGui::GetContentRegionAvail().y ), false, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoScrollWithMouse ); + const auto verticallyCenterTimeline = true; + if( m_yDelta != 0 ) { auto& io = ImGui::GetIO(); + if( !verticallyCenterTimeline ) + { + auto y = ImGui::GetScrollY(); + ImGui::SetScrollY( y - m_yDelta ); + } io.MouseClickedPos[1].y = io.MousePos.y; } @@ -378,7 +385,8 @@ void View::DrawTimeline() } } - m_tc.End( pxns, wpos, hover, drawMouseLine && m_viewMode == ViewMode::Paused, yMin, yMax ); + const auto vcenter = verticallyCenterTimeline && drawMouseLine && m_viewMode == ViewMode::Paused; + m_tc.End( pxns, wpos, hover, vcenter, yMin, yMax ); ImGui::EndChild(); m_lockHighlight = m_nextLockHighlight;