Add change handling for timing section

This commit is contained in:
Dean Herbert 2020-10-02 17:55:47 +09:00
parent c1c5b5da8e
commit 98fd661b23
2 changed files with 10 additions and 0 deletions

View File

@ -32,6 +32,9 @@ internal abstract class Section<T> : CompositeDrawable
[Resolved]
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; }
[Resolved(canBeNull: true)]
protected IEditorChangeHandler ChangeHandler { get; private set; }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{

View File

@ -37,8 +37,13 @@ protected override void OnControlPointChanged(ValueChangedEvent<TimingControlPoi
if (point.NewValue != null)
{
bpmSlider.Bindable = point.NewValue.BeatLengthBindable;
bpmSlider.Bindable.BindValueChanged(_ => ChangeHandler?.SaveState());
bpmTextEntry.Bindable = point.NewValue.BeatLengthBindable;
// no need to hook change handler here as it's the same bindable as above
timeSignature.Bindable = point.NewValue.TimeSignatureBindable;
timeSignature.Bindable.BindValueChanged(_ => ChangeHandler?.SaveState());
}
}
@ -117,6 +122,8 @@ public BPMSlider()
bpmBindable.BindValueChanged(bpm => beatLengthBindable.Value = beatLengthToBpm(bpm.NewValue));
base.Bindable = bpmBindable;
TransferValueOnCommit = true;
}
public override Bindable<double> Bindable