fix(ui): clickable channel pill, auto-seed channel, kill outer scrollbar
Three smoke bugs from the second in-game test: 1. The channel pill was draw-list only, so it didn't react to clicks and there was no way to switch channels inside a tab. The pill now has a hit area on top and opens a popup that lists every ChatType in tab.SelectedChannels with a ToInputChannel mapping; selecting one writes through CurrentChannel.SetChannel. 2. Switching to Allgemein / Gruppe / Linkshell still showed "—" because tab.CurrentChannel.Channel stayed at Invalid until somebody set it. The sidebar now seeds CurrentChannel on tab activation by walking SelectedChannels for the first key with a valid mapping, so every tab opens with its own real channel instead of inheriting the FC default. 3. MainWindow still surfaced an outer scrollbar next to the message list's own scroll. Adding NoScrollbar + NoScrollWithMouse to the window flags strips the second bar — the body child owns scroll on its own. Plus the system-icon path: System / BattleSystem / GatheringSystem / Error / Notice / LootNotice all map to fa-cog now, so the System tab renders the gear instead of falling back to the generic comment.
This commit is contained in:
@@ -110,8 +110,43 @@ internal sealed class InputBar
|
||||
dl.AddRectFilled(origin, max, pillAbgr, 6f);
|
||||
dl.AddText(origin + new Vector2(PillPaddingX, 3f), textAbgr, label);
|
||||
|
||||
// Reserve the layout slot so SameLine after the pill knows the width.
|
||||
ImGui.Dummy(new Vector2(width, PillHeight));
|
||||
// Hit area over the rendered pill so a click opens the channel
|
||||
// picker. InvisibleButton both reserves the layout slot and gives
|
||||
// the popup a stable anchor item.
|
||||
ImGui.InvisibleButton("##hellion-pill", new Vector2(width, PillHeight));
|
||||
if (ImGui.IsItemClicked() && tab is not null)
|
||||
ImGui.OpenPopup("##hellion-channel-picker");
|
||||
|
||||
DrawChannelPickerPopup(tab);
|
||||
}
|
||||
|
||||
private static void DrawChannelPickerPopup(Tab? tab)
|
||||
{
|
||||
if (!ImGui.BeginPopup("##hellion-channel-picker"))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
if (tab is null || tab.SelectedChannels.Count == 0)
|
||||
{
|
||||
ImGui.TextDisabled("No channels");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var chatType in tab.SelectedChannels.Keys)
|
||||
{
|
||||
if (chatType.ToInputChannel() is not { } input)
|
||||
continue;
|
||||
|
||||
var isCurrent = tab.CurrentChannel.Channel == input;
|
||||
if (ImGui.Selectable(input.ToChatType().Name(), isCurrent))
|
||||
tab.CurrentChannel.SetChannel(input);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawInputField(Tab? activeTab)
|
||||
|
||||
Reference in New Issue
Block a user