Add hovered frame markers on histogram.

This commit is contained in:
Bartosz Taudul 2019-06-17 00:59:16 +02:00
parent 099933e66d
commit f27cead040
2 changed files with 24 additions and 0 deletions

View File

@ -924,6 +924,9 @@ bool View::DrawImpl()
ImGui::SameLine();
TextDisabledUnformatted( m_notificationText.c_str() );
}
m_frameHover = -1;
DrawFrames();
DrawZones();
ImGui::End();
@ -1225,6 +1228,7 @@ void View::DrawFrames()
}
else
{
m_frameHover = sel;
if( m_frames->name == 0 )
{
const auto offset = m_worker.GetFrameOffset();
@ -1694,6 +1698,8 @@ bool View::DrawZoneFrames( const FrameData& frames )
{
ZoomToRange( fbegin, fend );
}
if( activeFrameSet ) m_frameHover = i;
}
if( fsz < MinFrameSize )
@ -8942,6 +8948,23 @@ void View::DrawInfo()
TextFocused( "Count:", RealToString( bins[bin], true ) );
ImGui::EndTooltip();
}
if( m_frameHover != -1 )
{
const auto frameTime = m_worker.GetFrameTime( *m_frames, m_frameHover );
float framePos;
if( m_frameSortData.logTime )
{
const auto ltmin = log10( tmin );
const auto ltmax = log10( tmax );
framePos = round( ( log10( frameTime ) - ltmin ) / float( ltmax - ltmin ) * numBins );
}
else
{
framePos = round( ( frameTime - tmin ) / float( tmax - tmin ) * numBins );
}
draw->AddLine( ImVec2( wpos.x + framePos, wpos.y ), ImVec2( wpos.x + framePos, wpos.y+Height-2 ), 0xFFFFFFFF );
}
}
}
}

View File

@ -264,6 +264,7 @@ private:
const FrameData* m_frames;
uint32_t m_lockInfoWindow = InvalidId;
ZoneEvent* m_zoneHover = nullptr;
int m_frameHover = -1;
Region m_highlight;
Region m_highlightZoom;