feat(sidebar): icon-only tabs with tooltip and 44px fixed width
This commit is contained in:
@@ -1383,12 +1383,13 @@ public sealed class ChatLogWindow : Window
|
|||||||
private void DrawTabSidebar()
|
private void DrawTabSidebar()
|
||||||
{
|
{
|
||||||
var currentTab = -1;
|
var currentTab = -1;
|
||||||
using var tabTable = ImRaii.Table("tabs-table", 2, ImGuiTableFlags.BordersInnerV | ImGuiTableFlags.SizingStretchProp | ImGuiTableFlags.Resizable);
|
// v1.2.0 — Sidebar fix 44 px, kein Resize. Mehr Platz fürs Chat-Log.
|
||||||
|
using var tabTable = ImRaii.Table("tabs-table", 2, ImGuiTableFlags.BordersInnerV | ImGuiTableFlags.SizingFixedFit);
|
||||||
if (!tabTable.Success)
|
if (!tabTable.Success)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ImGui.TableSetupColumn("tabs", ImGuiTableColumnFlags.WidthStretch, 1);
|
ImGui.TableSetupColumn("tabs", ImGuiTableColumnFlags.WidthFixed, 44f);
|
||||||
ImGui.TableSetupColumn("chat", ImGuiTableColumnFlags.WidthStretch, 4);
|
ImGui.TableSetupColumn("chat", ImGuiTableColumnFlags.WidthStretch, 1);
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
|
|
||||||
@@ -1422,7 +1423,6 @@ public sealed class ChatLogWindow : Window
|
|||||||
}
|
}
|
||||||
|
|
||||||
var unread = tabI == Plugin.LastTab || tab.UnreadMode == UnreadMode.None || tab.Unread == 0 ? "" : $" ({tab.Unread})";
|
var unread = tabI == Plugin.LastTab || tab.UnreadMode == UnreadMode.None || tab.Unread == 0 ? "" : $" ({tab.Unread})";
|
||||||
var selectableLabel = $"{tab.Name}{unread}###log-tab-{tabI}";
|
|
||||||
var isCurrentTab = Plugin.LastTab == tabI || Plugin.WantedTab == tabI;
|
var isCurrentTab = Plugin.LastTab == tabI || Plugin.WantedTab == tabI;
|
||||||
|
|
||||||
var showGreetedAffordance = tab.IsTempTab && Plugin.Config.AutoTellTabsShowGreetedToggle;
|
var showGreetedAffordance = tab.IsTempTab && Plugin.Config.AutoTellTabsShowGreetedToggle;
|
||||||
@@ -1457,34 +1457,38 @@ public sealed class ChatLogWindow : Window
|
|||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool clicked;
|
// v1.2.0 — Icon-only Sidebar mit Tooltip beim Hover.
|
||||||
if (showGreetedAffordance && tab.IsGreeted)
|
// Active-Tab kriegt Akzent-Color am Icon, Greeted-Tabs
|
||||||
{
|
// werden auf TextDim gedimmt (löst den alten Header-
|
||||||
// Dim the tab name once the user marked the partner
|
// Dim-Trick ab, da wir keine Selectable mehr nutzen).
|
||||||
// as greeted, so a glance at the sidebar tells them
|
var theme = Plugin.ThemeRegistry.Active;
|
||||||
// who still needs attention. Selectable has no idle
|
var icon = TabIconMapping.Resolve(tab);
|
||||||
// background slot in ImGui, so the dim only applies
|
var iconColor = isCurrentTab
|
||||||
// to the selected and hovered states — the text dim
|
? theme.Colors.Accent
|
||||||
// alone signals greeted in the idle state.
|
: (showGreetedAffordance && tab.IsGreeted ? theme.Colors.TextDim : theme.Colors.TextPrimary);
|
||||||
var headerBase = ImGui.GetColorU32(ImGuiCol.Header);
|
|
||||||
var hoverBase = ImGui.GetColorU32(ImGuiCol.HeaderHovered);
|
|
||||||
var dimHeader = (headerBase & 0xFF000000u) | ((headerBase & 0x00FEFEFEu) >> 1);
|
|
||||||
var dimHover = (hoverBase & 0xFF000000u) | ((hoverBase & 0x00FEFEFEu) >> 1);
|
|
||||||
|
|
||||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGui.GetColorU32(ImGuiCol.TextDisabled)))
|
bool clicked;
|
||||||
using (ImRaii.PushColor(ImGuiCol.Header, dimHeader))
|
using (ImRaii.PushColor(ImGuiCol.Button, 0u))
|
||||||
using (ImRaii.PushColor(ImGuiCol.HeaderHovered, dimHover))
|
using (ImRaii.PushColor(ImGuiCol.ButtonHovered, ColourUtil.RgbaToAbgr(theme.Colors.SurfaceHover)))
|
||||||
|
using (ImRaii.PushColor(ImGuiCol.ButtonActive, ColourUtil.RgbaToAbgr(theme.Colors.Surface)))
|
||||||
|
using (ImRaii.PushColor(ImGuiCol.Text, ColourUtil.RgbaToAbgr(iconColor)))
|
||||||
|
using (Plugin.FontManager.FontAwesome.Push())
|
||||||
{
|
{
|
||||||
clicked = ImGui.Selectable(selectableLabel, isCurrentTab);
|
clicked = ImGui.Button($"{icon.ToIconString()}##sidebar-tab-{tabI}", new Vector2(36f, 32f));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
// Tooltip mit Tab-Name + Unread-Counter beim Hover.
|
||||||
|
if (ImGui.IsItemHovered())
|
||||||
{
|
{
|
||||||
clicked = ImGui.Selectable(selectableLabel, isCurrentTab);
|
using var tt = ImRaii.Tooltip();
|
||||||
|
ImGui.TextUnformatted($"{tab.Name}{unread}");
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawTabContextMenu(tab, tabI);
|
DrawTabContextMenu(tab, tabI);
|
||||||
|
|
||||||
|
if (clicked)
|
||||||
|
Plugin.WantedTab = tabI;
|
||||||
|
|
||||||
if (!clicked && Plugin.WantedTab != tabI)
|
if (!clicked && Plugin.WantedTab != tabI)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user