1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 04:23:51 +00:00

Display time stamp when hovering mouse over time scale.

This commit is contained in:
Bartosz Taudul 2020-08-14 13:28:34 +02:00
parent 5e559322a0
commit 833653ce40

View File

@ -2020,16 +2020,20 @@ void View::DrawZoneFramesHeader()
const auto ty0375 = round( ty * 0.375f );
const auto ty05 = round( ty * 0.5f );
ImGui::InvisibleButton( "##zoneFrames", ImVec2( w, ty * 1.5f ) );
auto timespan = m_vd.zvEnd - m_vd.zvStart;
auto pxns = w / double( timespan );
{
const auto timespan = m_vd.zvEnd - m_vd.zvStart;
const auto pxns = w / double( timespan );
const auto nspx = 1.0 / pxns;
const auto scale = std::max( 0.0, round( log10( nspx ) + 2 ) );
const auto step = pow( 10, scale );
ImGui::InvisibleButton( "##zoneFrames", ImVec2( w, ty * 1.5f ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( TimeToStringExact( m_vd.zvStart + ( ImGui::GetIO().MousePos.x - wpos.x ) * nspx ) );
ImGui::EndTooltip();
}
const auto dx = step * pxns;
double x = 0;
int tw = 0;
@ -2074,7 +2078,6 @@ void View::DrawZoneFramesHeader()
x += dx;
tt += step;
}
}
}
static uint32_t DarkenColor( uint32_t color )