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

Merge pull request #24374 from peppy/fix-taiko-alignment

Fix osu!taiko editor playfield missing a piece
This commit is contained in:
Bartłomiej Dach 2023-07-28 22:46:01 +02:00 committed by GitHub
commit 318aa4627b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 4 deletions

View File

@ -11,6 +11,8 @@ namespace osu.Game.Rulesets.Taiko.Edit
{ {
public partial class TaikoHitObjectComposer : HitObjectComposer<TaikoHitObject> public partial class TaikoHitObjectComposer : HitObjectComposer<TaikoHitObject>
{ {
protected override bool ApplyHorizontalCentering => false;
public TaikoHitObjectComposer(TaikoRuleset ruleset) public TaikoHitObjectComposer(TaikoRuleset ruleset)
: base(ruleset) : base(ruleset)
{ {

View File

@ -44,6 +44,11 @@ namespace osu.Game.Rulesets.Edit
public abstract partial class HitObjectComposer<TObject> : HitObjectComposer, IPlacementHandler public abstract partial class HitObjectComposer<TObject> : HitObjectComposer, IPlacementHandler
where TObject : HitObject where TObject : HitObject
{ {
/// <summary>
/// Whether the playfield should be centered horizontally. Should be disabled for playfields which span the full horizontal width.
/// </summary>
protected virtual bool ApplyHorizontalCentering => true;
protected IRulesetConfigManager Config { get; private set; } protected IRulesetConfigManager Config { get; private set; }
// Provides `Playfield` // Provides `Playfield`
@ -119,8 +124,6 @@ namespace osu.Game.Rulesets.Edit
{ {
Name = "Playfield content", Name = "Playfield content",
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[] Children = new Drawable[]
{ {
// layers below playfield // layers below playfield
@ -241,8 +244,23 @@ namespace osu.Game.Rulesets.Edit
{ {
base.Update(); base.Update();
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. // 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) - 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; public override Playfield Playfield => drawableRulesetWrapper.Playfield;