mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 22:44:34 +00:00
Fix TimelineController height calculation.
This commit is contained in:
parent
d6772900ad
commit
e4ab6cdaf1
@ -7,7 +7,6 @@ namespace tracy
|
|||||||
|
|
||||||
TimelineController::TimelineController( View& view, Worker& worker )
|
TimelineController::TimelineController( View& view, Worker& worker )
|
||||||
: m_height( 0 )
|
: m_height( 0 )
|
||||||
, m_scroll( 0 )
|
|
||||||
, m_firstFrame( true )
|
, m_firstFrame( true )
|
||||||
, m_view( view )
|
, m_view( view )
|
||||||
, m_worker( worker )
|
, 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 );
|
item->Draw( m_firstFrame, pxns, offset, wpos, hover, yMin, yMax );
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto scrollPos = ImGui::GetScrollY();
|
m_height = offset;
|
||||||
if( scrollPos == 0 && m_scroll != 0 )
|
|
||||||
{
|
|
||||||
m_height = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( offset > m_height ) m_height = offset;
|
|
||||||
}
|
|
||||||
m_scroll = scrollPos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,6 @@ private:
|
|||||||
unordered_flat_map<const void*, std::unique_ptr<TimelineItem>> m_itemMap;
|
unordered_flat_map<const void*, std::unique_ptr<TimelineItem>> m_itemMap;
|
||||||
|
|
||||||
float m_height;
|
float m_height;
|
||||||
float m_scroll;
|
|
||||||
|
|
||||||
bool m_firstFrame;
|
bool m_firstFrame;
|
||||||
|
|
||||||
|
@ -333,6 +333,7 @@ void View::DrawTimeline()
|
|||||||
|
|
||||||
const auto wpos = ImGui::GetCursorScreenPos();
|
const auto wpos = ImGui::GetCursorScreenPos();
|
||||||
const auto dpos = wpos + ImVec2( 0.5f, 0.5f );
|
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<float>( m_tc.GetHeight(), ImGui::GetContentRegionAvail().y - 4 ); // magic border value
|
const auto h = std::max<float>( m_tc.GetHeight(), ImGui::GetContentRegionAvail().y - 4 ); // magic border value
|
||||||
|
|
||||||
ImGui::ItemSize( ImVec2( w, h ) );
|
ImGui::ItemSize( ImVec2( w, h ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user