From 2684c31f10712d0bce02ed13885ce3986b741584 Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Tue, 12 May 2026 19:09:43 +0200 Subject: [PATCH] fix(ui): scale active-tab underline with DPI for crisp rendering (F7.2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 2px underline pill was hardcoded — at 125/150% DPI the surrounding tab layout scaled with ImGuiHelpers.GlobalScale but the pill stayed 2px, so the line landed on sub-pixel boundaries and rendered as a fuzzy band. Now: height scales with GlobalScale (clamped to >=1px), and the DrawList coordinates round to physical pixels via MathF.Round so the rect aligns with the framebuffer grid. --- HellionChat/Ui/ChatLogWindow.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/HellionChat/Ui/ChatLogWindow.cs b/HellionChat/Ui/ChatLogWindow.cs index 0e90f83..9bb1f79 100644 --- a/HellionChat/Ui/ChatLogWindow.cs +++ b/HellionChat/Ui/ChatLogWindow.cs @@ -1637,17 +1637,21 @@ public sealed class ChatLogWindow : Window continue; // Active-tab underline pill (2px accent). No native ImGui underline API, - // so we use a direct DrawList pass. + // so we use a direct DrawList pass. Pill height scales with GlobalScale + // and all coordinates round to physical pixels so the line stays crisp + // on 125/150% DPI setups instead of bleeding into a sub-pixel blur. { var theme = Plugin.ThemeRegistry.Active; var min = ImGui.GetItemRectMin(); var max = ImGui.GetItemRectMax(); - const float pillHeight = 2f; + var pillHeight = MathF.Max(1f, MathF.Round(2f * ImGuiHelpers.GlobalScale)); + var yBottom = MathF.Round(max.Y); + var yTop = yBottom - pillHeight; ImGui .GetWindowDrawList() .AddRectFilled( - new Vector2(min.X, max.Y - pillHeight), - new Vector2(max.X, max.Y), + new Vector2(MathF.Round(min.X), yTop), + new Vector2(MathF.Round(max.X), yBottom), ColourUtil.RgbaToAbgr(theme.Colors.Accent) ); }