From b5f0d739e63ce9324baa689701b0227b873f5b97 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2023 16:25:52 +0900 Subject: [PATCH] Allow ladder editor grid to scale with content Closes https://github.com/ppy/osu/issues/24378. --- .../Screens/Editors/LadderEditorScreen.cs | 16 ++++++++++++++-- .../Screens/Ladder/LadderScreen.cs | 7 +++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs index 62d18ac9e5..f3c5566565 100644 --- a/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs @@ -37,6 +37,8 @@ namespace osu.Game.Tournament.Screens.Editors private WarningBox rightClickMessage; + private RectangularPositionSnapGrid grid; + [Resolved(canBeNull: true)] [CanBeNull] 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")); - ScrollContent.Add(new RectangularPositionSnapGrid(Vector2.Zero) + ScrollContent.Add(grid = new RectangularPositionSnapGrid(Vector2.Zero) { Spacing = new Vector2(GRID_SPACING), - RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BypassAutoSizeAxes = Axes.Both, Depth = float.MaxValue }); @@ -64,6 +68,14 @@ namespace osu.Game.Tournament.Screens.Editors 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() { rightClickMessage.Alpha = LadderInfo.Matches.Count > 0 ? 0 : 1; diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index a74c9a9429..2d5281b893 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -57,12 +57,15 @@ namespace osu.Game.Tournament.Screens.Ladder }, ScrollContent = new LadderDragContainer { - RelativeSizeAxes = Axes.Both, + AutoSizeAxes = Axes.Both, Children = new Drawable[] { paths = new Container { RelativeSizeAxes = Axes.Both }, headings = new Container { RelativeSizeAxes = Axes.Both }, - MatchesContainer = new Container { RelativeSizeAxes = Axes.Both }, + MatchesContainer = new Container + { + AutoSizeAxes = Axes.Both + }, } }, }