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

@ -20,6 +20,7 @@ namespace osu.Game.Screens.Select
public static readonly float HEIGHT = 24;
private readonly OsuTabControlCheckbox modsCheckbox;
private readonly OsuTabControl<BeatmapDetailTab> tabs;
private readonly Container tabsContainer;
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,
Colour = Color4.White.Opacity(0.2f),
},
tabs = new OsuTabControl<BeatmapDetailTab>
tabsContainer = new Container
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both,
Child = tabs = new OsuTabControl<BeatmapDetailTab>
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both,
},
},
modsCheckbox = new OsuTabControlCheckbox
{
@ -69,6 +74,13 @@ namespace osu.Game.Screens.Select
tabs.Current.TriggerChange();
}
protected override void Update()
{
base.Update();
tabsContainer.Padding = new MarginPadding { Right = modsCheckbox.Width };
}
private void invokeOnFilter()
{
OnFilter?.Invoke(tabs.Current.Value, modsCheckbox.Current.Value);