diff --git a/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs b/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs index 67019c2deb..e5cea34e7f 100644 --- a/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs +++ b/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs @@ -40,11 +40,11 @@ namespace osu.Game.Rulesets.Timing /// The hit object to add. public void Add(DrawableHitObject hitObject) { - if (hitObject.RelativePositionAxes == Axes.None) - throw new InvalidOperationException($"Make sure to set all {nameof(DrawableHitObject)}'s {nameof(RelativePositionAxes)} to some axis of relativity"); - var target = adjustmentContainerFor(hitObject); + if (hitObject.RelativePositionAxes != target.ScrollingAxes) + throw new InvalidOperationException($"Make sure to set all {nameof(DrawableHitObject)}'s {nameof(RelativePositionAxes)} are equal to the correct axes of scrolling ({target.ScrollingAxes})."); + if (target == null) throw new ArgumentException("No speed adjustment could be found that can contain the hit object.", nameof(hitObject)); diff --git a/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs b/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs index c78ccba0bd..0619880716 100644 --- a/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs +++ b/osu.Game/Rulesets/Timing/SpeedAdjustmentContainer.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Timing protected override Container Content => content; private Container content; - private readonly Axes scrollingAxes; + public readonly Axes ScrollingAxes; /// /// Creates a new . @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Timing /// The axes through which the content of this container should scroll through. protected SpeedAdjustmentContainer(MultiplierControlPoint controlPoint, Axes scrollingAxes) { - this.scrollingAxes = scrollingAxes; + ScrollingAxes = scrollingAxes; RelativeSizeAxes = Axes.Both; @@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Timing DrawableTimingSection timingSection = CreateTimingSection(); timingSection.VisibleTimeRange.BindTo(VisibleTimeRange); - timingSection.RelativeChildOffset = new Vector2((scrollingAxes & Axes.X) > 0 ? (float)ControlPoint.StartTime : 0, (scrollingAxes & Axes.Y) > 0 ? (float)ControlPoint.StartTime : 0); + timingSection.RelativeChildOffset = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)ControlPoint.StartTime : 0, (ScrollingAxes & Axes.Y) > 0 ? (float)ControlPoint.StartTime : 0); AddInternal(content = timingSection); } @@ -71,8 +71,8 @@ namespace osu.Game.Rulesets.Timing float multiplier = (float)ControlPoint.Multiplier; // The speed adjustment happens by modifying our size by the multiplier while maintaining the visible time range as the relatve size for our children - Size = new Vector2((scrollingAxes & Axes.X) > 0 ? multiplier : 1, (scrollingAxes & Axes.Y) > 0 ? multiplier : 1); - RelativeChildSize = new Vector2((scrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 1, (scrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 1); + Size = new Vector2((ScrollingAxes & Axes.X) > 0 ? multiplier : 1, (ScrollingAxes & Axes.Y) > 0 ? multiplier : 1); + RelativeChildSize = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 1, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 1); } ///