1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-11 10:03:22 +08:00
osu-lazer/osu.Game/Screens/Edit/Commands/MoveCommand.cs
2024-10-08 20:29:06 +02:00

28 lines
771 B
C#

// 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.Game.Rulesets.Objects.Types;
using osuTK;
namespace osu.Game.Screens.Edit.Commands
{
public class MoveCommand : IEditorCommand
{
public readonly IHasMutablePosition Target;
public readonly Vector2 Position;
public MoveCommand(IHasMutablePosition target, Vector2 position)
{
Target = target;
Position = position;
}
public void Apply() => Target.Position = Position;
public IEditorCommand CreateUndo() => new MoveCommand(Target, Target.Position);
public bool IsRedundant => Position == Target.Position;
}
}