Skip to content

Commit

Permalink
Fix drum rolls losing width on strong state toggle in editor
Browse files Browse the repository at this point in the history
Fixes #30480.
  • Loading branch information
bdach committed Nov 5, 2024
1 parent 5f1b696 commit 387fbc2
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ protected override void RecreatePieces()
{
base.RecreatePieces();
updateColour();
Height = HitObject.IsStrong ? TaikoStrongableHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE;
}

protected override void OnFree()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Skinning.Default;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
Expand Down Expand Up @@ -44,6 +45,12 @@ protected override void OnApply()
IsFirstTick.Value = HitObject.FirstTick;
}

protected override void RecreatePieces()
{
base.RecreatePieces();
Size = new Vector2(HitObject.IsStrong ? TaikoStrongableHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE);
}

protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (!userTriggered)
Expand Down
2 changes: 2 additions & 0 deletions osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Skinning.Default;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
Expand Down Expand Up @@ -63,6 +64,7 @@ protected override void RecreatePieces()
{
updateActionsFromType();
base.RecreatePieces();
Size = new Vector2(HitObject.IsStrong ? TaikoStrongableHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE);
}

protected override void OnFree()
Expand Down
11 changes: 10 additions & 1 deletion osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using osu.Game.Rulesets.Taiko.Skinning.Default;
using osu.Game.Screens.Play;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
Expand All @@ -34,6 +35,8 @@ public partial class DrawableSwell : DrawableTaikoHitObject<Swell>
/// </summary>
private const double ring_appear_offset = 100;

private Vector2 baseSize;

private readonly Container<DrawableSwellTick> ticks;
private readonly Container bodyContainer;
private readonly CircularContainer targetRing;
Expand Down Expand Up @@ -141,6 +144,12 @@ private void load(OsuColour colours)
Origin = Anchor.Centre,
});

protected override void RecreatePieces()
{
base.RecreatePieces();
Size = baseSize = new Vector2(TaikoHitObject.DEFAULT_SIZE);
}

protected override void OnFree()
{
base.OnFree();
Expand Down Expand Up @@ -269,7 +278,7 @@ protected override void Update()
{
base.Update();

Size = BaseSize * Parent!.RelativeChildSize;
Size = baseSize * Parent!.RelativeChildSize;

// Make the swell stop at the hit target
X = Math.Max(0, X);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ public abstract partial class DrawableTaikoHitObject<TObject> : DrawableTaikoHit

public new TObject HitObject => (TObject)base.HitObject;

protected Vector2 BaseSize;
protected SkinnableDrawable MainPiece;

protected DrawableTaikoHitObject([CanBeNull] TObject hitObject)
Expand All @@ -152,8 +151,6 @@ protected override void OnApply()

protected virtual void RecreatePieces()
{
Size = BaseSize = new Vector2(TaikoHitObject.DEFAULT_SIZE);

if (MainPiece != null)
Content.Remove(MainPiece, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;

namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
Expand Down Expand Up @@ -44,13 +43,6 @@ protected override void OnFree()
isStrong.UnbindEvents();
}

protected override void RecreatePieces()
{
base.RecreatePieces();
if (HitObject.IsStrong)
Size = BaseSize = new Vector2(TaikoStrongableHitObject.DEFAULT_STRONG_SIZE);
}

protected override void AddNestedHitObject(DrawableHitObject hitObject)
{
base.AddNestedHitObject(hitObject);
Expand Down

0 comments on commit 387fbc2

Please sign in to comment.