1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 02:22:56 +08:00

Use MathHelper.Clamp

- Fix formatting
This commit is contained in:
Kelvin 2017-08-28 22:51:26 -07:00
parent 2f5d8a7f88
commit 12be5b417d

View File

@ -148,8 +148,8 @@ namespace osu.Game.Overlays.Music
protected override bool OnDragEnd(InputState state)
{
int src = (int) Depth;
int dst = clamp((int) ((state.Mouse.Position.Y - Parent.DrawPosition.Y) / Height), 0, playlist.Count - 1);
int src = (int)Depth;
int dst = MathHelper.Clamp((int)(state.Mouse.Position.Y / Height), 0, playlist.Count - 1);
if (src == dst)
return true;
@ -164,15 +164,11 @@ namespace osu.Game.Overlays.Music
for (int i = dst; i < src; i++)
playlist.ChangeChildDepth(playlist[i], i + 1);
}
playlist.ChangeChildDepth(this, dst);
return true;
}
private int clamp(int value, int min, int max)
{
return value <= min ? min : value >= max ? max : value;
}
public string[] FilterTerms { get; private set; }
private bool matching = true;