From a8b42488add27067aedfbfb478d7809c7408418e Mon Sep 17 00:00:00 2001 From: simplyWiri Date: Sun, 2 Apr 2023 19:01:58 +1000 Subject: [PATCH] Clamp scrolling to the difference between the deepest zone near the mouse, and the height of the window. This prevents from unncessary scrolling when the trace does not exceed the size of the screen --- server/TracyTimelineController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/TracyTimelineController.cpp b/server/TracyTimelineController.cpp index 5600b676..f6f55038 100644 --- a/server/TracyTimelineController.cpp +++ b/server/TracyTimelineController.cpp @@ -160,7 +160,7 @@ void TimelineController::End( double pxns, const ImVec2& wpos, bool hover, bool if( const auto scrollY = CalculateScrollPosition() ) { - int clampedScrollY = std::min( *scrollY, yOffset ); + int clampedScrollY = std::min( *scrollY, std::max( yOffset - ImGui::GetWindowHeight(), 0 ) ); ImGui::SetScrollY( clampedScrollY ); int minHeight = ImGui::GetWindowHeight() + clampedScrollY; yOffset = std::max( yOffset, minHeight );