From 12be5b417d58b0a02773888472a40eb2e90847f6 Mon Sep 17 00:00:00 2001 From: Kelvin <2yangk23@gmail.com> Date: Mon, 28 Aug 2017 22:51:26 -0700 Subject: [PATCH] Use MathHelper.Clamp - Fix formatting --- osu.Game/Overlays/Music/PlaylistItem.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 85c8cd0c93..a86cca117a 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -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;