1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 10:02:59 +08:00

Fix tab controls overflowing

This commit is contained in:
Joehu 2019-10-06 10:22:55 -07:00
parent c2b44401b4
commit 38c1cee5fd
4 changed files with 35 additions and 15 deletions

View File

@ -9,7 +9,6 @@ using osuTK;
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Chat.Tabs namespace osu.Game.Overlays.Chat.Tabs
{ {
@ -25,19 +24,11 @@ namespace osu.Game.Overlays.Chat.Tabs
public ChannelTabControl() public ChannelTabControl()
{ {
TabContainer.Margin = new MarginPadding { Left = 50 }; Padding = new MarginPadding { Left = 50 };
TabContainer.Spacing = new Vector2(-SHEAR_WIDTH, 0); TabContainer.Spacing = new Vector2(-SHEAR_WIDTH, 0);
TabContainer.Masking = false; TabContainer.Masking = false;
AddInternal(new SpriteIcon
{
Icon = FontAwesome.Solid.Comments,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Size = new Vector2(20),
Margin = new MarginPadding(10),
});
AddTabItem(selectorTab = new ChannelSelectorTabItem()); AddTabItem(selectorTab = new ChannelSelectorTabItem());
ChannelSelectorActive.BindTo(selectorTab.Active); ChannelSelectorActive.BindTo(selectorTab.Active);

View File

@ -21,6 +21,7 @@ using osu.Game.Overlays.Chat;
using osu.Game.Overlays.Chat.Selection; using osu.Game.Overlays.Chat.Selection;
using osu.Game.Overlays.Chat.Tabs; using osu.Game.Overlays.Chat.Tabs;
using osuTK.Input; using osuTK.Input;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -156,6 +157,14 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Black, Colour = Color4.Black,
}, },
new SpriteIcon
{
Icon = FontAwesome.Solid.Comments,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Size = new Vector2(20),
Margin = new MarginPadding(10),
},
ChannelTabControl = CreateChannelTabControl().With(d => ChannelTabControl = CreateChannelTabControl().With(d =>
{ {
d.Anchor = Anchor.BottomLeft; d.Anchor = Anchor.BottomLeft;

View File

@ -18,6 +18,7 @@ namespace osu.Game.Overlays.SearchableList
private const float padding = 10; private const float padding = 10;
private readonly Container filterContainer; private readonly Container filterContainer;
private readonly Container tabsContainer;
private readonly Box tabStrip; private readonly Box tabStrip;
public readonly SearchTextBox Search; public readonly SearchTextBox Search;
@ -85,9 +86,14 @@ namespace osu.Game.Overlays.SearchableList
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = controls != null ? padding : 0 }, Margin = new MarginPadding { Top = controls != null ? padding : 0 },
}, },
Tabs = new PageTabControl<T> tabsContainer = new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Child = Tabs = new PageTabControl<T>
{
RelativeSizeAxes = Axes.X,
},
}, },
new Box //keep the tab strip part of autosize, but don't put it in the flow container new Box //keep the tab strip part of autosize, but don't put it in the flow container
{ {
@ -127,6 +133,8 @@ namespace osu.Game.Overlays.SearchableList
Height = filterContainer.Height; Height = filterContainer.Height;
DisplayStyleControl.Margin = new MarginPadding { Top = filterContainer.Height - 35, Right = SearchableListOverlay.WIDTH_PADDING }; DisplayStyleControl.Margin = new MarginPadding { Top = filterContainer.Height - 35, Right = SearchableListOverlay.WIDTH_PADDING };
tabsContainer.Padding = new MarginPadding { Right = DisplayStyleControl.Width };
} }
private class FilterSearchTextBox : SearchTextBox private class FilterSearchTextBox : SearchTextBox

View File

@ -20,6 +20,7 @@ namespace osu.Game.Screens.Select
public static readonly float HEIGHT = 24; public static readonly float HEIGHT = 24;
private readonly OsuTabControlCheckbox modsCheckbox; private readonly OsuTabControlCheckbox modsCheckbox;
private readonly OsuTabControl<BeatmapDetailTab> tabs; private readonly OsuTabControl<BeatmapDetailTab> tabs;
private readonly Container tabsContainer;
public Action<BeatmapDetailTab, bool> OnFilter; //passed the selected tab and if mods is checked public Action<BeatmapDetailTab, bool> OnFilter; //passed the selected tab and if mods is checked
@ -39,11 +40,15 @@ namespace osu.Game.Screens.Select
Height = 1, Height = 1,
Colour = Color4.White.Opacity(0.2f), Colour = Color4.White.Opacity(0.2f),
}, },
tabs = new OsuTabControl<BeatmapDetailTab> tabsContainer = new Container
{ {
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Child = tabs = new OsuTabControl<BeatmapDetailTab>
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both,
},
}, },
modsCheckbox = new OsuTabControlCheckbox modsCheckbox = new OsuTabControlCheckbox
{ {
@ -69,6 +74,13 @@ namespace osu.Game.Screens.Select
tabs.Current.TriggerChange(); tabs.Current.TriggerChange();
} }
protected override void Update()
{
base.Update();
tabsContainer.Padding = new MarginPadding { Right = modsCheckbox.Width };
}
private void invokeOnFilter() private void invokeOnFilter()
{ {
OnFilter?.Invoke(tabs.Current.Value, modsCheckbox.Current.Value); OnFilter?.Invoke(tabs.Current.Value, modsCheckbox.Current.Value);