Wrap emotes if space isn't enough

This commit is contained in:
Infi
2024-05-15 23:06:51 +02:00
parent 7736286fee
commit d49e2736b6
+4
View File
@@ -1584,6 +1584,10 @@ public sealed class ChatLogWindow : Window
var emoteSize = ImGui.CalcTextSize("W"); var emoteSize = ImGui.CalcTextSize("W");
emoteSize = emoteSize with { Y = emoteSize.X } * 1.5f; emoteSize = emoteSize with { Y = emoteSize.X } * 1.5f;
// TextWrap doesn't work for emotes, so we have to wrap them manually
if (ImGui.GetContentRegionAvail().X < emoteSize.X)
ImGui.NewLine();
// We only draw a dummy if it is still loading, in the case it failed we draw the actual name // We only draw a dummy if it is still loading, in the case it failed we draw the actual name
var image = EmoteCache.GetEmote(emotePayload.Code); var image = EmoteCache.GetEmote(emotePayload.Code);
if (image is { Failed: false }) if (image is { Failed: false })