mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 17:33:22 +08:00
Update ChannelTabControl in line with TabControl changes
This commit is contained in:
parent
1ce374ae2f
commit
c79d8a4251
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user