mirror of
https://github.com/wolfpld/tracy
synced 2025-05-01 21:23:52 +00:00
Thread view adjustment is timeline handling.
This commit is contained in:
parent
d9ce848bb0
commit
a46d3992a2
@ -1188,47 +1188,6 @@ bool View::DrawImpl()
|
|||||||
return keepOpen;
|
return keepOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
float View::AdjustThreadPosition( View::VisData& vis, float wy, int& offset )
|
|
||||||
{
|
|
||||||
if( vis.offset < offset )
|
|
||||||
{
|
|
||||||
vis.offset = offset;
|
|
||||||
}
|
|
||||||
else if( vis.offset > offset )
|
|
||||||
{
|
|
||||||
const auto diff = vis.offset - offset;
|
|
||||||
const auto move = std::max( 2.0, diff * 10.0 * ImGui::GetIO().DeltaTime );
|
|
||||||
offset = vis.offset = int( std::max<double>( vis.offset - move, offset ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return offset + wy;
|
|
||||||
}
|
|
||||||
|
|
||||||
void View::AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset )
|
|
||||||
{
|
|
||||||
const auto h = offset - oldOffset;
|
|
||||||
if( vis.height > h )
|
|
||||||
{
|
|
||||||
vis.height = h;
|
|
||||||
offset = oldOffset + vis.height;
|
|
||||||
}
|
|
||||||
else if( vis.height < h )
|
|
||||||
{
|
|
||||||
if( m_firstFrame )
|
|
||||||
{
|
|
||||||
vis.height = h;
|
|
||||||
offset = oldOffset + h;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const auto diff = h - vis.height;
|
|
||||||
const auto move = std::max( 2.0, diff * 10.0 * ImGui::GetIO().DeltaTime );
|
|
||||||
vis.height = int( std::min<double>( vis.height + move, h ) );
|
|
||||||
offset = oldOffset + vis.height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void View::DrawTextEditor()
|
void View::DrawTextEditor()
|
||||||
{
|
{
|
||||||
const auto scale = GetScale();
|
const auto scale = GetScale();
|
||||||
|
@ -12,6 +12,47 @@ enum { MinVisSize = 3 };
|
|||||||
|
|
||||||
extern double s_time;
|
extern double s_time;
|
||||||
|
|
||||||
|
float View::AdjustThreadPosition( View::VisData& vis, float wy, int& offset )
|
||||||
|
{
|
||||||
|
if( vis.offset < offset )
|
||||||
|
{
|
||||||
|
vis.offset = offset;
|
||||||
|
}
|
||||||
|
else if( vis.offset > offset )
|
||||||
|
{
|
||||||
|
const auto diff = vis.offset - offset;
|
||||||
|
const auto move = std::max( 2.0, diff * 10.0 * ImGui::GetIO().DeltaTime );
|
||||||
|
offset = vis.offset = int( std::max<double>( vis.offset - move, offset ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return offset + wy;
|
||||||
|
}
|
||||||
|
|
||||||
|
void View::AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset )
|
||||||
|
{
|
||||||
|
const auto h = offset - oldOffset;
|
||||||
|
if( vis.height > h )
|
||||||
|
{
|
||||||
|
vis.height = h;
|
||||||
|
offset = oldOffset + vis.height;
|
||||||
|
}
|
||||||
|
else if( vis.height < h )
|
||||||
|
{
|
||||||
|
if( m_firstFrame )
|
||||||
|
{
|
||||||
|
vis.height = h;
|
||||||
|
offset = oldOffset + h;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const auto diff = h - vis.height;
|
||||||
|
const auto move = std::max( 2.0, diff * 10.0 * ImGui::GetIO().DeltaTime );
|
||||||
|
vis.height = int( std::min<double>( vis.height + move, h ) );
|
||||||
|
offset = oldOffset + vis.height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void View::HandleTimelineMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns )
|
void View::HandleTimelineMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns )
|
||||||
{
|
{
|
||||||
assert( timespan > 0 );
|
assert( timespan > 0 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user