fix(toptab): size each tab selectable to its label width
This commit is contained in:
@@ -25,12 +25,17 @@ internal sealed class TopTabBar
|
|||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
var selected = ReferenceEquals(tab, activeTab);
|
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 (
|
if (
|
||||||
ImGui.Selectable(
|
ImGui.Selectable(
|
||||||
$"{tab.Name}###hellion_toptab_{i}",
|
$"{tab.Name}###hellion_toptab_{i}",
|
||||||
selected,
|
selected,
|
||||||
ImGuiSelectableFlags.None,
|
ImGuiSelectableFlags.None,
|
||||||
new Vector2(0, 0)
|
new Vector2(tabWidth, 0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user