Allow scrolling via drag while dragging a hold note handle

This commit is contained in:
Dean Herbert
2020-02-05 15:58:35 +09:00
parent cef45afbc8
commit 3d42973764
2 changed files with 41 additions and 15 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -28,6 +29,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
[UsedImplicitly]
private readonly Bindable<double> startTime;
public Action<DragEvent> OnDragHandled;
public const float THICKNESS = 5;
private const float circle_size = 16;
@ -78,7 +81,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
RelativeSizeAxes = Axes.Both,
}
},
new DragBar(hitObject),
new DragBar(hitObject) { OnDragHandled = e => OnDragHandled?.Invoke(e) }
});
}
}
@ -90,6 +93,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
[Resolved]
private Timeline timeline { get; set; }
public Action<DragEvent> OnDragHandled;
public DragBar(HitObject hitObject)
{
this.hitObject = hitObject;
@ -155,6 +160,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
base.OnDrag(e);
OnDragHandled?.Invoke(e);
var time = timeline.GetTimeFromScreenSpacePosition(e.ScreenSpaceMousePosition);
switch (hitObject)
@ -177,6 +184,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
beatmap.UpdateHitObject(hitObject);
}
protected override void OnDragEnd(DragEndEvent e)
{
base.OnDragEnd(e);
OnDragHandled?.Invoke(null);
}
}
protected override void Update()