1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 19:53:23 +08:00

Update ChannelTabControl in line with TabControl changes

This commit is contained in:
Dean Herbert 2020-06-16 00:12:32 +09:00
parent 1ce374ae2f
commit c79d8a4251

View File

@ -78,19 +78,10 @@ namespace osu.Game.Overlays.Chat.Tabs
/// <param name="channel">The channel that is going to be removed.</param> /// <param name="channel">The channel that is going to be removed.</param>
public void RemoveChannel(Channel channel) public void RemoveChannel(Channel channel)
{ {
if (Current.Value == channel)
{
var allChannels = TabContainer.AllTabItems.Select(tab => tab.Value).ToList();
var isNextTabSelector = allChannels[allChannels.IndexOf(channel) + 1] == selectorTab.Value;
// selectorTab is not switchable, so we have to explicitly select it if it's the only tab left
if (isNextTabSelector && allChannels.Count == 2)
SelectTab(selectorTab);
else
SwitchTab(isNextTabSelector ? -1 : 1);
}
RemoveItem(channel); RemoveItem(channel);
if (SelectedTab == null)
SelectTab(selectorTab);
} }
protected override void SelectTab(TabItem<Channel> tab) protected override void SelectTab(TabItem<Channel> tab)