Fix editor timing screen mutating the WorkingBeatmap instead of EditorBeatmap

This commit is contained in:
Dean Herbert
2021-01-04 16:38:15 +09:00
parent b4a779108e
commit 7fdf876b4c
7 changed files with 14 additions and 17 deletions

View File

@ -6,7 +6,6 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
@ -24,7 +23,7 @@ namespace osu.Game.Screens.Edit.Timing
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; }
[Resolved]
protected IBindable<WorkingBeatmap> Beatmap { get; private set; }
protected EditorBeatmap Beatmap { get; private set; }
[Resolved]
private EditorClock clock { get; set; }
@ -107,13 +106,13 @@ namespace osu.Game.Screens.Edit.Timing
var currentGroupItems = SelectedGroup.Value.ControlPoints.ToArray();
Beatmap.Value.Beatmap.ControlPointInfo.RemoveGroup(SelectedGroup.Value);
Beatmap.ControlPointInfo.RemoveGroup(SelectedGroup.Value);
foreach (var cp in currentGroupItems)
Beatmap.Value.Beatmap.ControlPointInfo.Add(time, cp);
Beatmap.ControlPointInfo.Add(time, cp);
// the control point might not necessarily exist yet, if currentGroupItems was empty.
SelectedGroup.Value = Beatmap.Value.Beatmap.ControlPointInfo.GroupAt(time, true);
SelectedGroup.Value = Beatmap.ControlPointInfo.GroupAt(time, true);
changeHandler?.EndChange();
}