1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-14 20:33:09 +08:00

Fix tab controls overflowing right content at max ui scale (#6411)

Fix tab controls overflowing right content at max ui scale
This commit is contained in:
Dean Herbert 2019-10-08 11:16:41 +09:00 committed by GitHub
commit 438408161c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 20 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

@ -85,9 +85,15 @@ 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> new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Right = 225 },
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
{ {

View File

@ -36,6 +36,11 @@ namespace osu.Game.Screens.Select
{ {
AddRangeInternal(new Drawable[] AddRangeInternal(new Drawable[]
{ {
content = new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT },
},
new BeatmapDetailAreaTabControl new BeatmapDetailAreaTabControl
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -58,11 +63,6 @@ namespace osu.Game.Screens.Select
} }
}, },
}, },
content = new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT },
},
}); });
AddRange(new Drawable[] AddRange(new Drawable[]

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,12 +40,16 @@ 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
{
RelativeSizeAxes = Axes.Both,
Child = tabs = new OsuTabControl<BeatmapDetailTab>
{ {
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
},
modsCheckbox = new OsuTabControlCheckbox modsCheckbox = new OsuTabControlCheckbox
{ {
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
@ -74,6 +79,8 @@ namespace osu.Game.Screens.Select
OnFilter?.Invoke(tabs.Current.Value, modsCheckbox.Current.Value); OnFilter?.Invoke(tabs.Current.Value, modsCheckbox.Current.Value);
modsCheckbox.FadeTo(tabs.Current.Value == BeatmapDetailTab.Details ? 0 : 1, 200, Easing.OutQuint); modsCheckbox.FadeTo(tabs.Current.Value == BeatmapDetailTab.Details ? 0 : 1, 200, Easing.OutQuint);
tabsContainer.Padding = new MarginPadding { Right = tabs.Current.Value == BeatmapDetailTab.Details ? 0 : 100 };
} }
} }