From b58354ac641cf92d9f80b83279054852f4bb4a38 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Jul 2023 15:20:19 +0900 Subject: [PATCH] Fix playfield getting cut off (again) at tall aspect ratios --- .../Edit/OsuHitObjectComposer.cs | 7 +------ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 8d93613156..0b80750a02 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -62,12 +62,7 @@ namespace osu.Game.Rulesets.Osu.Edit private void load() { // Give a bit of breathing room around the playfield content. - PlayfieldContentContainer.Padding = new MarginPadding - { - Vertical = 10, - // Intentionally use the left toolbox size for both sides to vertically centre the playfield. - Horizontal = TOOLBOX_CONTRACTED_SIZE_LEFT + 10, - }; + PlayfieldContentContainer.Padding = new MarginPadding(10); LayerBelowRuleset.AddRange(new Drawable[] { diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index d379242e3b..bad7c55883 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -117,13 +117,10 @@ namespace osu.Game.Rulesets.Edit { PlayfieldContentContainer = new Container { - Name = "Content", - Padding = new MarginPadding - { - Left = TOOLBOX_CONTRACTED_SIZE_LEFT, - Right = TOOLBOX_CONTRACTED_SIZE_RIGHT, - }, - RelativeSizeAxes = Axes.Both, + Name = "Playfield content", + RelativeSizeAxes = Axes.Y, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, Children = new Drawable[] { // layers below playfield @@ -240,6 +237,14 @@ namespace osu.Game.Rulesets.Edit }); } + protected override void Update() + { + base.Update(); + + // Ensure that the playfield is always centered but also doesn't get cut off by toolboxes. + PlayfieldContentContainer.Width = Math.Max(1024, DrawWidth) - TOOLBOX_CONTRACTED_SIZE_RIGHT * 2; + } + public override Playfield Playfield => drawableRulesetWrapper.Playfield; public override IEnumerable HitObjects => drawableRulesetWrapper.Playfield.AllHitObjects;