2022-08-15 11:29:45 +00:00
|
|
|
#include "imgui.h"
|
|
|
|
|
|
|
|
#include "TracyTimelineController.hpp"
|
|
|
|
|
|
|
|
namespace tracy
|
|
|
|
{
|
|
|
|
|
2022-09-03 16:34:11 +00:00
|
|
|
TimelineController::TimelineController( View& view, Worker& worker )
|
2022-08-15 11:29:45 +00:00
|
|
|
: m_height( 0 )
|
|
|
|
, m_scroll( 0 )
|
2022-08-20 15:02:29 +00:00
|
|
|
, m_firstFrame( true )
|
2022-09-03 14:38:39 +00:00
|
|
|
, m_view( view )
|
|
|
|
, m_worker( worker )
|
2022-08-15 11:29:45 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-08-20 15:02:29 +00:00
|
|
|
void TimelineController::FirstFrameExpired()
|
|
|
|
{
|
|
|
|
m_firstFrame = false;
|
|
|
|
}
|
|
|
|
|
2022-09-03 14:45:53 +00:00
|
|
|
void TimelineController::Begin()
|
2022-08-15 11:29:45 +00:00
|
|
|
{
|
2022-09-03 14:45:53 +00:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2022-08-15 11:29:45 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|