Skip to content

Commit

Permalink
Fix taiko playfield looking weird with new editor toolbox displays
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Oct 25, 2024
1 parent e37d415 commit 68e8819
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
3 changes: 3 additions & 0 deletions osu.Game.Rulesets.Taiko/Edit/DrawableTaikoEditorRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling;

namespace osu.Game.Rulesets.Taiko.Edit
Expand All @@ -20,6 +21,8 @@ public DrawableTaikoEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyLi
{
}

protected override Playfield CreatePlayfield() => new TaikoEditorPlayfield();

protected override void LoadComplete()
{
base.LoadComplete();
Expand Down
25 changes: 25 additions & 0 deletions osu.Game.Rulesets.Taiko/Edit/TaikoEditorPlayfield.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Skinning;

namespace osu.Game.Rulesets.Taiko.Edit
{
public partial class TaikoEditorPlayfield : TaikoPlayfield
{
[BackgroundDependencyLoader]
private void load()
{
// This is the simplest way to extend the taiko playfield beyond the left of the drum area.
// Required in the editor to not look weird underneath left toolbox area.
AddInternal(new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight())
{
Anchor = Anchor.TopLeft,
Origin = Anchor.TopRight,
});
}
}
}
4 changes: 2 additions & 2 deletions osu.Game/Rulesets/Edit/HitObjectComposer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ protected override void Update()
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;
PlayfieldContentContainer.Width = Math.Max(1024, DrawWidth);
PlayfieldContentContainer.X = LeftToolbox.DrawWidth;
}

composerFocusMode.Value = PlayfieldContentContainer.Contains(InputManager.CurrentState.Mouse.Position)
Expand Down

0 comments on commit 68e8819

Please sign in to comment.