diff --git a/osu-framework b/osu-framework index eba12eb4a0..63c9440bfb 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit eba12eb4a0fa6238873dd266deb35bfdece21a6a +Subproject commit 63c9440bfbd2bfb36f14c9ee0a521a6c46849cec diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 34dcc36699..71fdcff6af 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -34,7 +34,19 @@ namespace osu.Game.Overlays.Music public Action OnSelect; - public bool IsDraggable => handle.IsHovered; + public bool IsDraggable { get; private set; } + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + IsDraggable = handle.IsHovered; + return base.OnMouseDown(state, args); + } + + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + IsDraggable = false; + return base.OnMouseUp(state, args); + } private bool selected; public bool Selected diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index b3140d8bd0..74f6e4435d 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; @@ -65,9 +64,12 @@ namespace osu.Game.Overlays AlwaysPresent = true; } + private Vector2 dragStart; + protected override bool OnDragStart(InputState state) { base.OnDragStart(state); + dragStart = state.Mouse.Position; return true; } @@ -75,9 +77,7 @@ namespace osu.Game.Overlays { if (base.OnDrag(state)) return true; - Trace.Assert(state.Mouse.PositionMouseDown != null, "state.Mouse.PositionMouseDown != null"); - - Vector2 change = state.Mouse.Position - state.Mouse.PositionMouseDown.Value; + Vector2 change = state.Mouse.Position - dragStart; // Diminish the drag distance as we go further to simulate "rubber band" feeling. change *= change.Length <= 0 ? 0 : (float)Math.Pow(change.Length, 0.7f) / change.Length;