mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 04:02:57 +08:00
Fix timing adjustment repeat buttons firing one change per repeat invocation
This commit is contained in:
parent
0771265caf
commit
c30644328c
@ -23,6 +23,9 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
|
|
||||||
private Sample sample;
|
private Sample sample;
|
||||||
|
|
||||||
|
public Action RepeatBegan;
|
||||||
|
public Action RepeatEnded;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An additive modifier for the frequency of the sample played on next actuation.
|
/// An additive modifier for the frequency of the sample played on next actuation.
|
||||||
/// This can be adjusted during the button's <see cref="Drawable.OnClick"/> event to affect the repeat sample playback of that click.
|
/// This can be adjusted during the button's <see cref="Drawable.OnClick"/> event to affect the repeat sample playback of that click.
|
||||||
@ -44,6 +47,7 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
{
|
{
|
||||||
|
RepeatBegan?.Invoke();
|
||||||
beginRepeat();
|
beginRepeat();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -51,6 +55,7 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
protected override void OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
adjustDelegate?.Cancel();
|
adjustDelegate?.Cancel();
|
||||||
|
RepeatEnded?.Invoke();
|
||||||
base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,9 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OverlayColourProvider colourProvider { get; set; }
|
private OverlayColourProvider colourProvider { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private EditorBeatmap editorBeatmap { get; set; }
|
||||||
|
|
||||||
public TimingAdjustButton(double adjustAmount)
|
public TimingAdjustButton(double adjustAmount)
|
||||||
{
|
{
|
||||||
this.adjustAmount = adjustAmount;
|
this.adjustAmount = adjustAmount;
|
||||||
@ -72,7 +75,11 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
AddInternal(repeatBehaviour = new RepeatingButtonBehaviour(this));
|
AddInternal(repeatBehaviour = new RepeatingButtonBehaviour(this)
|
||||||
|
{
|
||||||
|
RepeatBegan = () => editorBeatmap.BeginChange(),
|
||||||
|
RepeatEnded = () => editorBeatmap.EndChange()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
Loading…
Reference in New Issue
Block a user