1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 12:22:55 +08:00

Allow seeking to sample point on double-click

This commit is contained in:
OliBomby 2024-07-04 11:47:45 +02:00
parent a4c575f77a
commit b9c6674a58
2 changed files with 20 additions and 0 deletions

View File

@ -2,7 +2,9 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Extensions;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Audio;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
@ -22,6 +24,14 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
NodeIndex = nodeIndex;
}
protected override bool OnDoubleClick(DoubleClickEvent e)
{
var hasRepeats = (IHasRepeats)HitObject;
EditorClock?.SeekSmoothlyTo(HitObject.StartTime + hasRepeats.Duration * NodeIndex / hasRepeats.SpanCount());
this.ShowPopover();
return true;
}
protected override IList<HitSampleInfo> GetSamples()
{
var hasRepeats = (IHasRepeats)HitObject;

View File

@ -32,6 +32,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
public readonly HitObject HitObject;
[Resolved]
protected EditorClock? EditorClock { get; private set; }
public SamplePointPiece(HitObject hitObject)
{
HitObject = hitObject;
@ -54,6 +57,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
return true;
}
protected override bool OnDoubleClick(DoubleClickEvent e)
{
EditorClock?.SeekSmoothlyTo(HitObject.StartTime);
this.ShowPopover();
return true;
}
private void updateText()
{
Label.Text = $"{abbreviateBank(GetBankValue(GetSamples()))} {GetVolumeValue(GetSamples())}";