From deba6e2508359d484b63edf51236915681e69a20 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jul 2023 02:22:46 +0900 Subject: [PATCH 1/4] Fix osu!taiko editor playfield missing a piece Regressed with recent centering changes in https://github.com/ppy/osu/pull/24220 --- osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs | 2 ++ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs index cff5731181..add10b0ac5 100644 --- a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs +++ b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs @@ -11,6 +11,8 @@ namespace osu.Game.Rulesets.Taiko.Edit { public partial class TaikoHitObjectComposer : HitObjectComposer { + protected override bool ApplyVerticalCentering => false; + public TaikoHitObjectComposer(TaikoRuleset ruleset) : base(ruleset) { diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index bad7c55883..6fbc39c8ae 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -44,6 +44,11 @@ namespace osu.Game.Rulesets.Edit public abstract partial class HitObjectComposer : HitObjectComposer, IPlacementHandler where TObject : HitObject { + /// + /// Whether the playfield should be centered vertically. Should be disabled for playfields which span the full horizontal width. + /// + protected virtual bool ApplyVerticalCentering => true; + protected IRulesetConfigManager Config { get; private set; } // Provides `Playfield` @@ -242,7 +247,7 @@ namespace osu.Game.Rulesets.Edit 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; + PlayfieldContentContainer.Width = Math.Max(1024, DrawWidth) - (ApplyVerticalCentering ? TOOLBOX_CONTRACTED_SIZE_RIGHT : TOOLBOX_CONTRACTED_SIZE_LEFT) * 2; } public override Playfield Playfield => drawableRulesetWrapper.Playfield; From c9155f85ab83d12771621dc82240320f2f09ec19 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jul 2023 16:40:14 +0900 Subject: [PATCH 2/4] Fix playfield not taking up full width correclty when not vertically centered --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 6fbc39c8ae..dbca8694ae 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -124,8 +124,6 @@ namespace osu.Game.Rulesets.Edit { Name = "Playfield content", RelativeSizeAxes = Axes.Y, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, Children = new Drawable[] { // layers below playfield @@ -247,7 +245,22 @@ namespace osu.Game.Rulesets.Edit base.Update(); // Ensure that the playfield is always centered but also doesn't get cut off by toolboxes. - PlayfieldContentContainer.Width = Math.Max(1024, DrawWidth) - (ApplyVerticalCentering ? TOOLBOX_CONTRACTED_SIZE_RIGHT : TOOLBOX_CONTRACTED_SIZE_LEFT) * 2; + if (ApplyVerticalCentering) + { + PlayfieldContentContainer.Anchor = Anchor.Centre; + PlayfieldContentContainer.Origin = Anchor.Centre; + + PlayfieldContentContainer.Width = Math.Max(1024, DrawWidth) - TOOLBOX_CONTRACTED_SIZE_RIGHT * 2; + PlayfieldContentContainer.X = 0; + } + else + { + PlayfieldContentContainer.Anchor = Anchor.CentreLeft; + PlayfieldContentContainer.Origin = Anchor.CentreLeft; + + PlayfieldContentContainer.Width = Math.Max(1024, DrawWidth) - (TOOLBOX_CONTRACTED_SIZE_LEFT + TOOLBOX_CONTRACTED_SIZE_RIGHT); + PlayfieldContentContainer.X = TOOLBOX_CONTRACTED_SIZE_LEFT; + } } public override Playfield Playfield => drawableRulesetWrapper.Playfield; From 6d018c08afc1573a921e3cfb28e1e13b67f45cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 28 Jul 2023 22:09:28 +0200 Subject: [PATCH 3/4] Rename `Apply{Vertical -> Horizontal}Centering` to match common understanding --- osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs index add10b0ac5..3e63d624e7 100644 --- a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs +++ b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs @@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Taiko.Edit { public partial class TaikoHitObjectComposer : HitObjectComposer { - protected override bool ApplyVerticalCentering => false; + protected override bool ApplyHorizontalCentering => false; public TaikoHitObjectComposer(TaikoRuleset ruleset) : base(ruleset) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index dbca8694ae..71ca13e4ba 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -45,9 +45,9 @@ namespace osu.Game.Rulesets.Edit where TObject : HitObject { /// - /// Whether the playfield should be centered vertically. Should be disabled for playfields which span the full horizontal width. + /// Whether the playfield should be centered horizontally. Should be disabled for playfields which span the full horizontal width. /// - protected virtual bool ApplyVerticalCentering => true; + protected virtual bool ApplyHorizontalCentering => true; protected IRulesetConfigManager Config { get; private set; } @@ -245,7 +245,7 @@ namespace osu.Game.Rulesets.Edit base.Update(); // Ensure that the playfield is always centered but also doesn't get cut off by toolboxes. - if (ApplyVerticalCentering) + if (ApplyHorizontalCentering) { PlayfieldContentContainer.Anchor = Anchor.Centre; PlayfieldContentContainer.Origin = Anchor.Centre; From caad931a16c3712130f01b1bc54a3c58a3728c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 28 Jul 2023 22:10:10 +0200 Subject: [PATCH 4/4] Move comment to more fitting place --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 71ca13e4ba..c967187b5c 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -244,12 +244,12 @@ namespace osu.Game.Rulesets.Edit { base.Update(); - // Ensure that the playfield is always centered but also doesn't get cut off by toolboxes. if (ApplyHorizontalCentering) { PlayfieldContentContainer.Anchor = Anchor.Centre; PlayfieldContentContainer.Origin = Anchor.Centre; + // 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; PlayfieldContentContainer.X = 0; }