1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-16 01:42:58 +08:00

Merge pull request #18161 from Joehuu/column-flow-cq

Improve code quality of mod column flow container
This commit is contained in:
Bartłomiej Dach 2022-05-09 19:44:54 +02:00 committed by GitHub
commit c52b6d9e80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Framework.Layout;
using osu.Framework.Lists;
using osu.Framework.Utils;
using osu.Game.Audio;
@ -125,11 +124,14 @@ namespace osu.Game.Overlays.Mods
ScrollbarOverlapsContent = false,
Child = columnFlow = new ColumnFlowContainer
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Direction = FillDirection.Horizontal,
Shear = new Vector2(SHEAR, 0),
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Margin = new MarginPadding { Horizontal = 70 },
Padding = new MarginPadding { Bottom = 10 },
Children = new[]
{
createModColumnContent(ModType.DifficultyReduction, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }),
@ -521,19 +523,12 @@ namespace osu.Game.Overlays.Mods
}
/// <summary>
/// Manages padding and layout of mod columns.
/// Manages layout of mod columns.
/// </summary>
internal class ColumnFlowContainer : FillFlowContainer<ColumnDimContainer>
{
public IEnumerable<ModColumn> Columns => Children.Select(dimWrapper => dimWrapper.Column);
private readonly LayoutValue drawSizeLayout = new LayoutValue(Invalidation.DrawSize);
public ColumnFlowContainer()
{
AddLayout(drawSizeLayout);
}
public override void Add(ColumnDimContainer dimContainer)
{
base.Add(dimContainer);
@ -541,22 +536,6 @@ namespace osu.Game.Overlays.Mods
Debug.Assert(dimContainer != null);
dimContainer.Column.Shear = Vector2.Zero;
}
protected override void Update()
{
base.Update();
if (!drawSizeLayout.IsValid)
{
Padding = new MarginPadding
{
Left = DrawHeight * SHEAR,
Bottom = 10
};
drawSizeLayout.Validate();
}
}
}
/// <summary>