1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Refactor the use of offset in TimelineItem::Draw() and TimelineController::End().

This commit is contained in:
Tomaž Vöröš
2023-01-27 20:00:05 +01:00
parent 52b6af88ca
commit 7b9b810421
5 changed files with 37 additions and 30 deletions
+7 -4
View File
@@ -24,17 +24,20 @@ void TimelineController::Begin()
m_items.clear();
}
void TimelineController::End( double pxns, int offset, const ImVec2& wpos, bool hover, float yMin, float yMax )
void TimelineController::End( double pxns, const ImVec2& wpos, bool hover, float yMin, float yMax )
{
int yOffset = 0;
for( auto& item : m_items )
{
item->Draw( m_firstFrame, pxns, offset, wpos, hover, yMin, yMax );
item->Draw( m_firstFrame, pxns, yOffset, wpos, hover, yMin, yMax );
yOffset += item->GetNextFrameHeight();
}
const auto scrollPos = ImGui::GetScrollY();
if( ( scrollPos == 0 && m_scroll != 0 ) || offset > m_height )
if( ( scrollPos == 0 && m_scroll != 0 ) || yOffset > m_height )
{
m_height = offset;
m_height = yOffset;
}
m_scroll = scrollPos;
}