mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 22:26:41 +09:00
Fix undo/redo behaving poorly with simultaneous objects
This commit is contained in:
@ -136,14 +136,26 @@ namespace osu.Game.Screens.Edit
|
||||
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
||||
public void Add(HitObject hitObject)
|
||||
{
|
||||
trackStartTime(hitObject);
|
||||
|
||||
// Preserve existing sorting order in the beatmap
|
||||
var insertionIndex = findInsertionIndex(PlayableBeatmap.HitObjects, hitObject.StartTime);
|
||||
mutableHitObjects.Insert(insertionIndex + 1, hitObject);
|
||||
Insert(insertionIndex + 1, hitObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts a <see cref="HitObject"/> into this <see cref="EditorBeatmap"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// It is the invoker's responsibility to make sure that <see cref="HitObject"/> sorting order is maintained.
|
||||
/// </remarks>
|
||||
/// <param name="index">The index to insert the <see cref="HitObject"/> at.</param>
|
||||
/// <param name="hitObject">The <see cref="HitObject"/> to insert.</param>
|
||||
public void Insert(int index, HitObject hitObject)
|
||||
{
|
||||
trackStartTime(hitObject);
|
||||
|
||||
mutableHitObjects.Insert(index, hitObject);
|
||||
|
||||
HitObjectAdded?.Invoke(hitObject);
|
||||
|
||||
updateHitObject(hitObject, true);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user