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

Allow ladder editor grid to scale with content

Closes https://github.com/ppy/osu/issues/24378.
This commit is contained in:
Dean Herbert 2023-07-28 16:25:52 +09:00
parent 0e4db9b439
commit b5f0d739e6
2 changed files with 19 additions and 4 deletions

View File

@ -37,6 +37,8 @@ namespace osu.Game.Tournament.Screens.Editors
private WarningBox rightClickMessage; private WarningBox rightClickMessage;
private RectangularPositionSnapGrid grid;
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
[CanBeNull] [CanBeNull]
private IDialogOverlay dialogOverlay { get; set; } private IDialogOverlay dialogOverlay { get; set; }
@ -53,10 +55,12 @@ namespace osu.Game.Tournament.Screens.Editors
AddInternal(rightClickMessage = new WarningBox("Right click to place and link matches")); AddInternal(rightClickMessage = new WarningBox("Right click to place and link matches"));
ScrollContent.Add(new RectangularPositionSnapGrid(Vector2.Zero) ScrollContent.Add(grid = new RectangularPositionSnapGrid(Vector2.Zero)
{ {
Spacing = new Vector2(GRID_SPACING), Spacing = new Vector2(GRID_SPACING),
RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre,
Origin = Anchor.Centre,
BypassAutoSizeAxes = Axes.Both,
Depth = float.MaxValue Depth = float.MaxValue
}); });
@ -64,6 +68,14 @@ namespace osu.Game.Tournament.Screens.Editors
updateMessage(); updateMessage();
} }
protected override void Update()
{
base.Update();
// Expand grid with the content to allow going beyond the bounds of the screen.
grid.Size = ScrollContent.Size + new Vector2(GRID_SPACING * 2);
}
private void updateMessage() private void updateMessage()
{ {
rightClickMessage.Alpha = LadderInfo.Matches.Count > 0 ? 0 : 1; rightClickMessage.Alpha = LadderInfo.Matches.Count > 0 ? 0 : 1;

View File

@ -57,12 +57,15 @@ namespace osu.Game.Tournament.Screens.Ladder
}, },
ScrollContent = new LadderDragContainer ScrollContent = new LadderDragContainer
{ {
RelativeSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
paths = new Container<Path> { RelativeSizeAxes = Axes.Both }, paths = new Container<Path> { RelativeSizeAxes = Axes.Both },
headings = new Container { RelativeSizeAxes = Axes.Both }, headings = new Container { RelativeSizeAxes = Axes.Both },
MatchesContainer = new Container<DrawableTournamentMatch> { RelativeSizeAxes = Axes.Both }, MatchesContainer = new Container<DrawableTournamentMatch>
{
AutoSizeAxes = Axes.Both
},
} }
}, },
} }