mirror of https://github.com/ppy/osu
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:
parent
8bca8d6072
commit
86432078dd
|
@ -198,15 +198,26 @@ private void setOrigin(ScaleOrigin origin)
|
|||
updateAxisCheckBoxesEnabled();
|
||||
}
|
||||
|
||||
private Vector2? getOriginPosition(PreciseScaleInfo scale) =>
|
||||
scale.Origin switch
|
||||
private Vector2? getOriginPosition(PreciseScaleInfo scale)
|
||||
{
|
||||
ScaleOrigin.GridCentre => gridToolbox.StartPosition.Value,
|
||||
ScaleOrigin.PlayfieldCentre => OsuPlayfield.BASE_SIZE / 2,
|
||||
ScaleOrigin.SelectionCentre when selectedItems.Count == 1 && selectedItems.First() is Slider slider => slider.Position,
|
||||
ScaleOrigin.SelectionCentre => null,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(scale))
|
||||
};
|
||||
switch (scale.Origin)
|
||||
{
|
||||
case ScaleOrigin.GridCentre:
|
||||
return gridToolbox.StartPosition.Value;
|
||||
|
||||
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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue