1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-10 23:59:19 +08:00
osu-lazer/osu.Game.Rulesets.Osu/Edit/Commands/AddControlPointCommand.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
1021 B
C#
Raw Normal View History

// 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 osu.Framework.Bindables;
using osu.Game.Rulesets.Objects;
using osu.Game.Screens.Edit.Commands;
namespace osu.Game.Rulesets.Osu.Edit.Commands
{
public class AddControlPointCommand : IEditorCommand
{
public readonly BindableList<PathControlPoint> ControlPoints;
public readonly int InsertionIndex;
public readonly PathControlPoint ControlPoint;
public AddControlPointCommand(BindableList<PathControlPoint> controlPoints, int insertionIndex, PathControlPoint controlPoint)
{
ControlPoints = controlPoints;
InsertionIndex = insertionIndex;
ControlPoint = controlPoint;
}
public void Apply() => ControlPoints.Insert(InsertionIndex, ControlPoint);
public IEditorCommand CreateUndo() => new RemoveControlPointCommand(ControlPoints, InsertionIndex);
}
}