mirror of https://github.com/ppy/osu
Merge pull request #18687 from peppy/editor-repeat-behaviour-change-collapsing
Fix timing adjustment repeat buttons firing one change per repeat invocation
This commit is contained in:
commit
cc7943dfb1
|
@ -23,6 +23,9 @@ public class RepeatingButtonBehaviour : Component
|
|||
|
||||
private Sample sample;
|
||||
|
||||
public Action RepeatBegan;
|
||||
public Action RepeatEnded;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
|
@ -44,6 +47,7 @@ private void load(AudioManager audio)
|
|||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
RepeatBegan?.Invoke();
|
||||
beginRepeat();
|
||||
return true;
|
||||
}
|
||||
|
@ -51,6 +55,7 @@ protected override bool OnMouseDown(MouseDownEvent e)
|
|||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
adjustDelegate?.Cancel();
|
||||
RepeatEnded?.Invoke();
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,9 @@ public LocalisableString Text
|
|||
[Resolved]
|
||||
private OverlayColourProvider colourProvider { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private EditorBeatmap editorBeatmap { get; set; }
|
||||
|
||||
public TimingAdjustButton(double adjustAmount)
|
||||
{
|
||||
this.adjustAmount = adjustAmount;
|
||||
|
@ -72,7 +75,11 @@ public TimingAdjustButton(double adjustAmount)
|
|||
}
|
||||
});
|
||||
|
||||
AddInternal(repeatBehaviour = new RepeatingButtonBehaviour(this));
|
||||
AddInternal(repeatBehaviour = new RepeatingButtonBehaviour(this)
|
||||
{
|
||||
RepeatBegan = () => editorBeatmap.BeginChange(),
|
||||
RepeatEnded = () => editorBeatmap.EndChange()
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
|
Loading…
Reference in New Issue