Try to fix stuttering behavior

This commit is contained in:
Kelvin
2017-08-29 22:25:04 -07:00
parent e5bf3f6a6a
commit 0e363fce1e

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -151,6 +150,9 @@ namespace osu.Game.Overlays.Music
{ {
private readonly FillFlowContainer<PlaylistItem> playlist; private readonly FillFlowContainer<PlaylistItem> playlist;
private const int line_height = 22;
private const int rearrange_buffer = 3;
public PlaylistItemHandle(FillFlowContainer<PlaylistItem> playlist) public PlaylistItemHandle(FillFlowContainer<PlaylistItem> playlist)
{ {
this.playlist = playlist; this.playlist = playlist;
@ -202,7 +204,12 @@ namespace osu.Game.Overlays.Music
max = m - 1; max = m - 1;
} }
return (int)items[Math.Max(0, min - 1)].Depth; int index = Math.Max(0, min - 1);
// Only move if mouse falls within buffer
if (position - items[index].Y > rearrange_buffer && position - items[index].Y < line_height - rearrange_buffer) {
return (int)items[index].Depth;
}
return (int)Parent.Depth;
} }
} }
} }