fix(ui): hide status bar version when window is too narrow
Below roughly 340 px content width the version slot starts overlapping the four slots to its left because the right-aligned SameLine still plants the text where its baseline would have been. New 200 px width threshold drops the version line entirely below that, so the other slots stay readable. The version is back as soon as the window grows.
This commit is contained in:
@@ -144,14 +144,20 @@ internal sealed class StatusBar
|
||||
ImGui.TextUnformatted(_cachedTellsText);
|
||||
}
|
||||
|
||||
// Slot 5: version, right-aligned, muted
|
||||
// Slot 5: version, right-aligned, muted. Hidden when the window is
|
||||
// too narrow to fit all five slots — the other four need ~200 px
|
||||
// before the version text starts clipping into them.
|
||||
var versionText = $"v{Plugin.Interface.Manifest.AssemblyVersion} · Hellion";
|
||||
var versionWidth = ImGui.CalcTextSize(versionText).X;
|
||||
var contentRegionMax = ImGui.GetContentRegionMax().X;
|
||||
ImGui.SameLine(contentRegionMax - versionWidth);
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ColourUtil.RgbaToAbgr(theme.Colors.TextMuted)))
|
||||
const float MinOtherSlotsWidth = 200f;
|
||||
if (contentRegionMax - versionWidth > MinOtherSlotsWidth)
|
||||
{
|
||||
ImGui.TextUnformatted(versionText);
|
||||
ImGui.SameLine(contentRegionMax - versionWidth);
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ColourUtil.RgbaToAbgr(theme.Colors.TextMuted)))
|
||||
{
|
||||
ImGui.TextUnformatted(versionText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user