1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Extract normalized name tooltip function.

This commit is contained in:
Bartosz Taudul
2022-08-15 19:43:03 +02:00
parent 63d074c5d8
commit 4d0591cf2f
3 changed files with 22 additions and 15 deletions
+20
View File
@@ -117,4 +117,24 @@ const char* ShortenZoneName( ShortenName type, const char* name, ImVec2& tsz, fl
}
}
void TooltipNormalizedName( const char* name, const char* normalized )
{
if( ImGui::IsItemHovered() && normalized != name && strcmp( normalized, name ) != 0 )
{
const auto scale = ImGui::GetTextLineHeight() / 15.f;
if( ImGui::CalcTextSize( name ).x > 1400 * scale )
{
ImGui::SetNextWindowSize( ImVec2( 1400 * scale, 0 ) );
ImGui::BeginTooltip();
ImGui::TextWrapped( "%s", name );
}
else
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( name );
}
ImGui::EndTooltip();
}
}
}