diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 61dc2638a6..f943d817a8 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -41,10 +41,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables Origin = Anchor.TopCentre } }); - - // The "length" of the hold note stops at the "base" of the tail piece - // but we want to contain the tail piece within our bounds - Height += (float)HitObject.Duration / headPiece.Height; } public override Color4 AccentColour diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index 8832fc8d48..a105c21e43 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -15,8 +15,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables public DrawableNote(Note hitObject) : base(hitObject) { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; + RelativeSizeAxes = Axes.Both; + Height = 100; Add(headPiece = new NotePiece { diff --git a/osu.Game.Rulesets.Mania/Timing/TimeRelativeContainer.cs b/osu.Game.Rulesets.Mania/Timing/TimeRelativeContainer.cs index 8ca30488ff..64b5b4e5ef 100644 --- a/osu.Game.Rulesets.Mania/Timing/TimeRelativeContainer.cs +++ b/osu.Game.Rulesets.Mania/Timing/TimeRelativeContainer.cs @@ -71,6 +71,9 @@ namespace osu.Game.Rulesets.Mania.Timing { private readonly ControlPoint timingChange; + protected override Container Content => content; + private readonly Container content; + /// /// Creates a drawable timing section. The height of this container will be proportional /// to the beat length of the timing section and the timespan of its parent at all times. @@ -89,7 +92,14 @@ namespace osu.Game.Rulesets.Mania.Timing RelativeSizeAxes = Axes.Both; - Y = -(float)timingChange.Time; + AddInternal(content = new AutoTimeRelativeContainer + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.Both, + Y = -(float)timingChange.Time + }); } protected override void Update() @@ -101,7 +111,7 @@ namespace osu.Game.Rulesets.Mania.Timing RelativeCoordinateSpace = new Vector2(1, (float)parent.TimeSpan); // Scroll the content - Y = (float)(Time.Current - timingChange.Time); + content.Y = (float)(Time.Current - timingChange.Time); } public override void Add(Drawable drawable) @@ -120,7 +130,28 @@ namespace osu.Game.Rulesets.Mania.Timing /// can be placed within the timing section's bounds (in this case, from the start of the timing section up to infinity). /// /// The drawable to check. - public bool CanContain(Drawable drawable) => Y >= drawable.Y; + public bool CanContain(Drawable drawable) => content.Y >= drawable.Y; + + private class AutoTimeRelativeContainer : Container + { + public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) + { + float height = 0; + + foreach (Drawable child in Children) + { + // Todo: This is wrong, it won't work for absolute-y-sized children + float childEndPos = -child.Y + child.Height; + if (childEndPos > height) + height = childEndPos; + } + + Height = height; + RelativeCoordinateSpace = new Vector2(1, height); + + return base.Invalidate(invalidation, source, shallPropagate); + } + } } } } \ No newline at end of file