Fix continuous frames tooltips.

At high zoom-out levels frame tooltip will be always displayed now for
continuous frame sets. This greatly helps with scrubbing to an
appropriate location, basing of frame images.
This commit is contained in:
Bartosz Taudul 2020-02-10 00:41:18 +01:00
parent ffdd5290bf
commit d0c2a26ced

View File

@ -1867,6 +1867,7 @@ bool View::DrawZoneFrames( const FrameData& frames )
const auto redColor = GetColorMuted( 0x4444FF, activeFrameSet ); const auto redColor = GetColorMuted( 0x4444FF, activeFrameSet );
int i = zrange.first; int i = zrange.first;
auto x1 = ( m_worker.GetFrameBegin( frames, i ) - m_vd.zvStart ) * pxns;
while( i < zrange.second ) while( i < zrange.second )
{ {
const auto ftime = m_worker.GetFrameTime( frames, i ); const auto ftime = m_worker.GetFrameTime( frames, i );
@ -1874,7 +1875,11 @@ bool View::DrawZoneFrames( const FrameData& frames )
const auto fend = m_worker.GetFrameEnd( frames, i ); const auto fend = m_worker.GetFrameEnd( frames, i );
const auto fsz = pxns * ftime; const auto fsz = pxns * ftime;
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( ( fbegin - m_vd.zvStart ) * pxns, 0 ), wpos + ImVec2( ( fend - m_vd.zvStart ) * pxns, ty ) ) ) if( hover )
{
const auto x0 = frames.continuous ? x1 : ( fbegin - m_vd.zvStart ) * pxns;
x1 = ( fend - m_vd.zvStart ) * pxns;
if( ImGui::IsMouseHoveringRect( wpos + ImVec2( x0, 0 ), wpos + ImVec2( x1, ty ) ) )
{ {
tooltipDisplayed = true; tooltipDisplayed = true;
@ -1919,6 +1924,7 @@ bool View::DrawZoneFrames( const FrameData& frames )
if( activeFrameSet ) m_frameHover = i; if( activeFrameSet ) m_frameHover = i;
} }
}
if( fsz < MinFrameSize ) if( fsz < MinFrameSize )
{ {