mirror of https://github.com/ppy/osu
Ensure columns collapse into one correctly if no space
This commit is contained in:
parent
090c8ee602
commit
1bab2236fe
|
@ -233,7 +233,7 @@ public override IEnumerable<Drawable> CreateEditorSetupSections() =>
|
|||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(25),
|
||||
Spacing = new Vector2(SetupScreen.SPACING),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ResourcesSection
|
||||
|
|
|
@ -346,7 +346,7 @@ public override IEnumerable<Drawable> CreateEditorSetupSections() =>
|
|||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(25),
|
||||
Spacing = new Vector2(SetupScreen.SPACING),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ResourcesSection
|
||||
|
|
|
@ -15,6 +15,10 @@ namespace osu.Game.Screens.Edit.Setup
|
|||
{
|
||||
public partial class SetupScreen : EditorScreen
|
||||
{
|
||||
public const float COLUMN_WIDTH = 450;
|
||||
public const float SPACING = 28;
|
||||
public const float MAX_WIDTH = 2 * COLUMN_WIDTH + SPACING;
|
||||
|
||||
public SetupScreen()
|
||||
: base(EditorScreenMode.SongSetup)
|
||||
{
|
||||
|
@ -23,6 +27,9 @@ public SetupScreen()
|
|||
[Cached]
|
||||
private SetupScreenHeaderBackground background = new SetupScreenHeaderBackground { RelativeSizeAxes = Axes.Both, };
|
||||
|
||||
private OsuScrollContainer scroll = null!;
|
||||
private FillFlowContainer flow = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(EditorBeatmap beatmap, OverlayColourProvider colourProvider)
|
||||
{
|
||||
|
@ -51,31 +58,24 @@ private void load(EditorBeatmap beatmap, OverlayColourProvider colourProvider)
|
|||
},
|
||||
new Drawable[]
|
||||
{
|
||||
new OsuScrollContainer
|
||||
scroll = new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding(15),
|
||||
Child = new FillFlowContainer
|
||||
Child = flow = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Full,
|
||||
Spacing = new Vector2(28),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
Width = 925,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Spacing = new Vector2(25),
|
||||
ChildrenEnumerable = ruleset.CreateEditorSetupSections().Select(section => section.With(s =>
|
||||
{
|
||||
s.Width = 450;
|
||||
s.Anchor = Anchor.TopCentre;
|
||||
s.Origin = Anchor.TopCentre;
|
||||
})),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,22 @@ private void load(EditorBeatmap beatmap, OverlayColourProvider colourProvider)
|
|||
};
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
if (scroll.DrawWidth > MAX_WIDTH)
|
||||
{
|
||||
flow.RelativeSizeAxes = Axes.None;
|
||||
flow.Width = MAX_WIDTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
flow.RelativeSizeAxes = Axes.X;
|
||||
flow.Width = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnExiting(ScreenExitEvent e)
|
||||
{
|
||||
base.OnExiting(e);
|
||||
|
|
Loading…
Reference in New Issue