Schedule drag events for now

This commit is contained in:
Dean Herbert 2021-10-15 19:52:29 +09:00
parent 30c3fcb4ea
commit c47497923a

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Threading;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -371,10 +372,17 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
return true; return true;
} }
private ScheduledDelegate dragOperation;
protected override void OnDrag(DragEvent e) protected override void OnDrag(DragEvent e)
{ {
base.OnDrag(e); base.OnDrag(e);
// schedule is temporary to ensure we don't process multiple times on a single update frame. we need to find a better method of doing this.
// without it, a hitobject's endtime may not always be in a valid state (ie. sliders, which needs to recompute their path).
dragOperation?.Cancel();
dragOperation = Scheduler.Add(() =>
{
OnDragHandled?.Invoke(e); OnDragHandled?.Invoke(e);
if (timeline.SnapScreenSpacePositionToValidTime(e.ScreenSpaceMousePosition).Time is double time) if (timeline.SnapScreenSpacePositionToValidTime(e.ScreenSpaceMousePosition).Time is double time)
@ -423,6 +431,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
break; break;
} }
} }
});
} }
protected override void OnDragEnd(DragEndEvent e) protected override void OnDragEnd(DragEndEvent e)