Select another group after deleting selected

This commit is contained in:
Dean Herbert 2019-10-27 16:30:05 +09:00
parent 73369ae613
commit 81b5d7b79f
1 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -57,7 +58,7 @@ public class ControlPointList : CompositeDrawable
private IBindableList<ControlPointGroup> controlGroups;
[Resolved]
protected IFrameBasedClock EditorClock { get; private set; }
private IFrameBasedClock clock { get; set; }
[Resolved]
protected IBindable<WorkingBeatmap> Beatmap { get; private set; }
@ -133,11 +134,13 @@ private void delete()
return;
Beatmap.Value.Beatmap.ControlPointInfo.RemoveGroup(selectedGroup.Value);
selectedGroup.Value = Beatmap.Value.Beatmap.ControlPointInfo.Groups.FirstOrDefault(g => g.Time >= clock.CurrentTime);
}
private void addNew()
{
selectedGroup.Value = Beatmap.Value.Beatmap.ControlPointInfo.CreateGroup(EditorClock.CurrentTime);
selectedGroup.Value = Beatmap.Value.Beatmap.ControlPointInfo.CreateGroup(clock.CurrentTime);
}
}
}