Don't animate threads on first frame.

This commit is contained in:
Bartosz Taudul 2020-04-12 23:41:18 +02:00
parent a074d18dfa
commit b8647f968a
2 changed files with 17 additions and 5 deletions

View File

@ -701,6 +701,7 @@ bool View::DrawImpl()
m_lockInfoAnim.Update( io.DeltaTime );
m_statBuzzAnim.Update( io.DeltaTime );
if( m_firstFrame ) m_firstFrame = false;
return keepOpen;
}
@ -2069,7 +2070,7 @@ static float AdjustThreadPosition( View::VisData& vis, float wy, int& offset )
return offset + wy;
}
static void AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset )
void View::AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset )
{
const auto h = offset - oldOffset;
if( vis.height > h )
@ -2079,10 +2080,18 @@ static void AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset )
}
else if( vis.height < h )
{
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;
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;
}
}
}

View File

@ -288,6 +288,8 @@ private:
return it->second;
}
void AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset );
Worker m_worker;
std::string m_filename;
bool m_staticView;
@ -419,6 +421,7 @@ private:
UserData m_userData;
bool m_reconnectRequested = false;
bool m_firstFrame = true;
struct FindZone {
enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 };