fix(ui): scale active-tab underline with DPI for crisp rendering (F7.2)

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.
This commit is contained in:
2026-05-12 19:09:43 +02:00
parent bdd64cad07
commit 2684c31f10
+8 -4
View File
@@ -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)
);
}