1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 00:33:20 +08:00
osu-lazer/osu.Game/Screens/Edit/Commands/MoveXCommand.cs

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

28 lines
743 B
C#
Raw Normal View History

2024-10-09 03:22:05 +08:00
// 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.Utils;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Screens.Edit.Commands
{
public class MoveXCommand : IEditorCommand
{
public readonly IHasMutablePosition Target;
public readonly float X;
public MoveXCommand(IHasMutablePosition target, float x)
{
Target = target;
X = x;
}
public void Apply() => Target.X = X;
public IEditorCommand CreateUndo() => new MoveXCommand(Target, Target.X);
public bool IsRedundant => Precision.AlmostEquals(X, Target.X);
}
}