Skip to content

Commit 526e41b

Browse files
committed
Don't show image tooltip, if there's no shortening and it fits the space.
1 parent cfc6772 commit 526e41b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

profiler/src/profiler/TracyView_Samples.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -524,11 +524,14 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
524524
ImGui::TableNextColumn();
525525
if( m_shortImageNames )
526526
{
527-
const char* end = imageName + strlen( imageName ) - 1;
528-
while( end > imageName && *end != '/' && *end != '\\' ) end--;
529-
if( *end == '/' || *end == '\\' ) end++;
530-
TextDisabledUnformatted( end );
531-
TooltipIfHovered( imageName );
527+
const char* end = imageName + strlen( imageName );
528+
const char* ptr = end - 1;
529+
while( ptr > imageName && *ptr != '/' && *ptr != '\\' ) ptr--;
530+
if( *ptr == '/' || *ptr == '\\' ) ptr++;
531+
const auto cw = ImGui::GetContentRegionAvail().x;
532+
const auto tw = ImGui::CalcTextSize( imageName, end ).x;
533+
TextDisabledUnformatted( ptr );
534+
if( ptr != imageName || tw > cw ) TooltipIfHovered( imageName );
532535
}
533536
else
534537
{

0 commit comments

Comments
 (0)