Remove usage of switch expression syntax

It's not universally accepted here and a `when` crept in that can be
bypassed entirely using rather clean baseline language constructs, so
why bother at this point.
This commit is contained in:
Bartłomiej Dach 2024-09-24 11:53:02 +02:00
parent 8bca8d6072
commit 86432078dd
No known key found for this signature in database

View File

@ -198,15 +198,26 @@ namespace osu.Game.Rulesets.Osu.Edit
updateAxisCheckBoxesEnabled(); updateAxisCheckBoxesEnabled();
} }
private Vector2? getOriginPosition(PreciseScaleInfo scale) => private Vector2? getOriginPosition(PreciseScaleInfo scale)
scale.Origin switch
{ {
ScaleOrigin.GridCentre => gridToolbox.StartPosition.Value, switch (scale.Origin)
ScaleOrigin.PlayfieldCentre => OsuPlayfield.BASE_SIZE / 2, {
ScaleOrigin.SelectionCentre when selectedItems.Count == 1 && selectedItems.First() is Slider slider => slider.Position, case ScaleOrigin.GridCentre:
ScaleOrigin.SelectionCentre => null, return gridToolbox.StartPosition.Value;
_ => throw new ArgumentOutOfRangeException(nameof(scale))
}; case ScaleOrigin.PlayfieldCentre:
return OsuPlayfield.BASE_SIZE / 2;
case ScaleOrigin.SelectionCentre:
if (selectedItems.Count == 1 && selectedItems.First() is Slider slider)
return slider.Position;
return null;
default:
throw new ArgumentOutOfRangeException(nameof(scale));
}
}
private Axes getAdjustAxis(PreciseScaleInfo scale) => scale.XAxis ? scale.YAxis ? Axes.Both : Axes.X : Axes.Y; private Axes getAdjustAxis(PreciseScaleInfo scale) => scale.XAxis ? scale.YAxis ? Axes.Both : Axes.X : Axes.Y;