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

Don't show image tooltip, if there's no shortening and it fits the space.

This commit is contained in:
Bartosz Taudul 2025-02-07 02:43:32 +01:00
parent cfc67727a0
commit 526e41b5dc
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -524,11 +524,14 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
ImGui::TableNextColumn();
if( m_shortImageNames )
{
const char* end = imageName + strlen( imageName ) - 1;
while( end > imageName && *end != '/' && *end != '\\' ) end--;
if( *end == '/' || *end == '\\' ) end++;
TextDisabledUnformatted( end );
TooltipIfHovered( imageName );
const char* end = imageName + strlen( imageName );
const char* ptr = end - 1;
while( ptr > imageName && *ptr != '/' && *ptr != '\\' ) ptr--;
if( *ptr == '/' || *ptr == '\\' ) ptr++;
const auto cw = ImGui::GetContentRegionAvail().x;
const auto tw = ImGui::CalcTextSize( imageName, end ).x;
TextDisabledUnformatted( ptr );
if( ptr != imageName || tw > cw ) TooltipIfHovered( imageName );
}
else
{