From e4ab6cdaf1928ae80abb4d362f5ed642f461f390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20V=C3=B6r=C3=B6=C5=A1?= Date: Sun, 18 Dec 2022 20:45:05 +0100 Subject: [PATCH] Fix TimelineController height calculation. --- server/TracyTimelineController.cpp | 12 +----------- server/TracyTimelineController.hpp | 1 - server/TracyView_Timeline.cpp | 1 + 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/server/TracyTimelineController.cpp b/server/TracyTimelineController.cpp index 7cabd444..296a0e88 100644 --- a/server/TracyTimelineController.cpp +++ b/server/TracyTimelineController.cpp @@ -7,7 +7,6 @@ namespace tracy TimelineController::TimelineController( View& view, Worker& worker ) : m_height( 0 ) - , m_scroll( 0 ) , m_firstFrame( true ) , m_view( view ) , m_worker( worker ) @@ -31,16 +30,7 @@ void TimelineController::End( double pxns, int offset, const ImVec2& wpos, bool item->Draw( m_firstFrame, pxns, offset, wpos, hover, yMin, yMax ); } - const auto scrollPos = ImGui::GetScrollY(); - if( scrollPos == 0 && m_scroll != 0 ) - { - m_height = 0; - } - else - { - if( offset > m_height ) m_height = offset; - } - m_scroll = scrollPos; + m_height = offset; } } diff --git a/server/TracyTimelineController.hpp b/server/TracyTimelineController.hpp index 1d8e4f37..58f9bb15 100644 --- a/server/TracyTimelineController.hpp +++ b/server/TracyTimelineController.hpp @@ -43,7 +43,6 @@ private: unordered_flat_map> m_itemMap; float m_height; - float m_scroll; bool m_firstFrame; diff --git a/server/TracyView_Timeline.cpp b/server/TracyView_Timeline.cpp index d7a3f996..406a945b 100644 --- a/server/TracyView_Timeline.cpp +++ b/server/TracyView_Timeline.cpp @@ -333,6 +333,7 @@ void View::DrawTimeline() const auto wpos = ImGui::GetCursorScreenPos(); const auto dpos = wpos + ImVec2( 0.5f, 0.5f ); + // note that m_tc.GetHeight() returns the height from the previous draw const auto h = std::max( m_tc.GetHeight(), ImGui::GetContentRegionAvail().y - 4 ); // magic border value ImGui::ItemSize( ImVec2( w, h ) );