mirror of https://github.com/ppy/osu
Fix tab controls overflowing
This commit is contained in:
parent
c2b44401b4
commit
38c1cee5fd
|
@ -9,7 +9,6 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Chat.Tabs
|
||||
{
|
||||
|
@ -25,19 +24,11 @@ public class ChannelTabControl : OsuTabControl<Channel>
|
|||
|
||||
public ChannelTabControl()
|
||||
{
|
||||
TabContainer.Margin = new MarginPadding { Left = 50 };
|
||||
Padding = new MarginPadding { Left = 50 };
|
||||
|
||||
TabContainer.Spacing = new Vector2(-SHEAR_WIDTH, 0);
|
||||
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());
|
||||
|
||||
ChannelSelectorActive.BindTo(selectorTab.Active);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
using osu.Game.Overlays.Chat.Selection;
|
||||
using osu.Game.Overlays.Chat.Tabs;
|
||||
using osuTK.Input;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
|
@ -156,6 +157,14 @@ private void load(OsuConfigManager config, OsuColour colours, ChannelManager cha
|
|||
RelativeSizeAxes = Axes.Both,
|
||||
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 =>
|
||||
{
|
||||
d.Anchor = Anchor.BottomLeft;
|
||||
|
|
|
@ -18,6 +18,7 @@ public abstract class SearchableListFilterControl<T, U> : Container
|
|||
private const float padding = 10;
|
||||
|
||||
private readonly Container filterContainer;
|
||||
private readonly Container tabsContainer;
|
||||
private readonly Box tabStrip;
|
||||
|
||||
public readonly SearchTextBox Search;
|
||||
|
@ -85,9 +86,14 @@ protected SearchableListFilterControl()
|
|||
AutoSizeAxes = Axes.Y,
|
||||
Margin = new MarginPadding { Top = controls != null ? padding : 0 },
|
||||
},
|
||||
Tabs = new PageTabControl<T>
|
||||
tabsContainer = new Container
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -127,6 +133,8 @@ protected override void Update()
|
|||
|
||||
Height = filterContainer.Height;
|
||||
DisplayStyleControl.Margin = new MarginPadding { Top = filterContainer.Height - 35, Right = SearchableListOverlay.WIDTH_PADDING };
|
||||
|
||||
tabsContainer.Padding = new MarginPadding { Right = DisplayStyleControl.Width };
|
||||
}
|
||||
|
||||
private class FilterSearchTextBox : SearchTextBox
|
||||
|
|
|
@ -20,6 +20,7 @@ public class BeatmapDetailAreaTabControl : Container
|
|||
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 @@ public BeatmapDetailAreaTabControl()
|
|||
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 @@ private void load(OsuColour colour, OsuConfigManager config)
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue