New TimelineController begin/end logic.

This commit is contained in:
Bartosz Taudul 2022-09-03 16:45:53 +02:00
parent 8034fce416
commit 9355a14657
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 15 additions and 3 deletions

View File

@ -20,8 +20,18 @@ void TimelineController::FirstFrameExpired()
m_firstFrame = false; m_firstFrame = false;
} }
void TimelineController::End( float offset ) void TimelineController::Begin()
{ {
m_items.clear();
}
void TimelineController::End( double pxns, int offset, const ImVec2& wpos, bool hover, float yMin, float yMax )
{
for( auto& item : m_items )
{
item->Draw( m_firstFrame, pxns, offset, wpos, hover, yMin, yMax );
}
const auto scrollPos = ImGui::GetScrollY(); const auto scrollPos = ImGui::GetScrollY();
if( scrollPos == 0 && m_scroll != 0 ) if( scrollPos == 0 && m_scroll != 0 )
{ {

View File

@ -25,7 +25,8 @@ public:
TimelineController( View& view, const Worker& worker ); TimelineController( View& view, const Worker& worker );
void FirstFrameExpired(); void FirstFrameExpired();
void End( float offset ); void Begin();
void End( double pxns, int offset, const ImVec2& wpos, bool hover, float yMin, float yMax );
template<class T, class U> template<class T, class U>
void AddItem( U* data ) void AddItem( U* data )

View File

@ -291,6 +291,7 @@ void View::DrawTimeline()
} }
} }
m_tc.Begin();
DrawTimelineFramesHeader(); DrawTimelineFramesHeader();
auto& frames = m_worker.GetFrames(); auto& frames = m_worker.GetFrames();
for( auto fd : frames ) for( auto fd : frames )
@ -1039,7 +1040,7 @@ void View::DrawTimeline()
offset = DrawPlots( offset, pxns, wpos, hover, yMin, yMax ); offset = DrawPlots( offset, pxns, wpos, hover, yMin, yMax );
} }
m_tc.End( offset ); m_tc.End( pxns, offset, wpos, hover, yMin, yMax );
ImGui::EndChild(); ImGui::EndChild();
for( auto& ann : m_annotations ) for( auto& ann : m_annotations )