From a6e90ebc0b02e4749a50191c4798359ea478b343 Mon Sep 17 00:00:00 2001 From: SitiSchu Date: Sat, 16 Aug 2025 23:44:24 +0200 Subject: [PATCH] Keep the aspect ratio of (de)buff icons intact --- ChatTwo/PayloadHandler.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ChatTwo/PayloadHandler.cs b/ChatTwo/PayloadHandler.cs index 2a696bdb..e5aff20e 100755 --- a/ChatTwo/PayloadHandler.cs +++ b/ChatTwo/PayloadHandler.cs @@ -340,7 +340,13 @@ public unsafe void MoveTooltip(AddonEvent type, AddonArgs args) private static void InlineIcon(IDalamudTextureWrap icon) { var cursor = ImGui.GetCursorPos(); - var size = ImGuiHelpers.ScaledVector2(32, 32); + const int maxIconSize = 32; + // Keep the icons aspect ratio while also shrinking it down so its at most 32px wide/tall + var iconRatio = icon.Size.X / icon.Size.Y; + var x = Math.Min(maxIconSize, (int) (maxIconSize * iconRatio)); + var y = Math.Min(maxIconSize, (int) (maxIconSize / iconRatio)); + var size = ImGuiHelpers.ScaledVector2(x, y); + ImGui.Image(icon.Handle, size); ImGui.SameLine(); ImGui.SetCursorPos(cursor + new Vector2(size.X + 4, size.Y - ImGui.GetTextLineHeightWithSpacing()));