fix(toptab): size each tab selectable to its label width

This commit is contained in:
2026-06-16 00:24:18 +02:00
parent 4db2ad99b9
commit 8e2d333130
+6 -1
View File
@@ -25,12 +25,17 @@ internal sealed class TopTabBar
ImGui.SameLine();
var selected = ReferenceEquals(tab, activeTab);
// Size the selectable to its own label width. A zero width makes ImGui
// stretch the selectable's box to the full remaining window width
// (imgui_widgets.cpp:7378), so in this SameLine row every tab overlaps
// into one giant bar and clicking never lands on the intended tab.
var tabWidth = ImGui.CalcTextSize(tab.Name).X;
if (
ImGui.Selectable(
$"{tab.Name}###hellion_toptab_{i}",
selected,
ImGuiSelectableFlags.None,
new Vector2(0, 0)
new Vector2(tabWidth, 0)
)
)
{