mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 10:23:20 +08:00
Rename MoveCommand
to SetPositionCommand
This commit is contained in:
parent
3fb986e8bb
commit
7d243ebcbe
@ -419,7 +419,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
|
||||
Vector2 movementDelta = Parent!.ToLocalSpace(result?.ScreenSpacePosition ?? newHeadPosition) - hitObject.Position;
|
||||
|
||||
commandHandler.SafeSubmit(new MoveCommand(hitObject, hitObject.Position + movementDelta));
|
||||
commandHandler.SafeSubmit(new SetPositionCommand(hitObject, hitObject.Position + movementDelta));
|
||||
commandHandler.SafeSubmit(new SetStartTimeCommand(hitObject, result?.Time ?? hitObject.StartTime));
|
||||
|
||||
for (int i = 1; i < hitObject.Path.ControlPoints.Count; i++)
|
||||
@ -455,7 +455,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
for (int i = 0; i < hitObject.Path.ControlPoints.Count; i++)
|
||||
commandHandler.SafeSubmit(new UpdateControlPointCommand(hitObject.Path.ControlPoints[i]) { Position = oldControlPoints[i] });
|
||||
|
||||
commandHandler.SafeSubmit(new MoveCommand(hitObject, oldPosition));
|
||||
commandHandler.SafeSubmit(new SetPositionCommand(hitObject, oldPosition));
|
||||
commandHandler.SafeSubmit(new SetStartTimeCommand(hitObject, oldStartTime));
|
||||
// Snap the path length again to undo the invalid length.
|
||||
hitObject.SnapTo(distanceSnapProvider, commandHandler);
|
||||
|
@ -482,7 +482,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
foreach (var c in controlPoints)
|
||||
commandHandler.SafeSubmit(new UpdateControlPointCommand(c) { Position = c.Position - first });
|
||||
|
||||
commandHandler.SafeSubmit(new MoveCommand(HitObject, HitObject.Position + first));
|
||||
commandHandler.SafeSubmit(new SetPositionCommand(HitObject, HitObject.Position + first));
|
||||
}
|
||||
|
||||
private void splitControlPoints(List<PathControlPoint> controlPointsToSplitAt)
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Commands
|
||||
public Vector2 Position
|
||||
{
|
||||
get => HitObject.Position;
|
||||
set => Submit(new MoveCommand(HitObject, value));
|
||||
set => Submit(new SetPositionCommand(HitObject, value));
|
||||
}
|
||||
|
||||
public bool NewCombo
|
||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
localDelta = moveSelectionInBounds(localDelta);
|
||||
|
||||
foreach (var h in hitObjects)
|
||||
commandManager.SafeSubmit(new MoveCommand(h, h.Position + localDelta));
|
||||
commandManager.SafeSubmit(new SetPositionCommand(h, h.Position + localDelta));
|
||||
|
||||
// manually update stacking.
|
||||
// this intentionally bypasses the editor `UpdateState()` / beatmap processor flow for performance reasons,
|
||||
|
@ -6,13 +6,13 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Commands
|
||||
{
|
||||
public class MoveCommand : IEditorCommand, IMergeableCommand
|
||||
public class SetPositionCommand : IEditorCommand, IMergeableCommand
|
||||
{
|
||||
public readonly IHasMutablePosition Target;
|
||||
|
||||
public readonly Vector2 Position;
|
||||
|
||||
public MoveCommand(IHasMutablePosition target, Vector2 position)
|
||||
public SetPositionCommand(IHasMutablePosition target, Vector2 position)
|
||||
{
|
||||
Target = target;
|
||||
Position = position;
|
||||
@ -20,13 +20,13 @@ namespace osu.Game.Screens.Edit.Commands
|
||||
|
||||
public void Apply() => Target.Position = Position;
|
||||
|
||||
public IEditorCommand CreateUndo() => new MoveCommand(Target, Target.Position);
|
||||
public IEditorCommand CreateUndo() => new SetPositionCommand(Target, Target.Position);
|
||||
|
||||
public bool IsRedundant => Position == Target.Position;
|
||||
|
||||
public IEditorCommand? MergeWith(IEditorCommand previous)
|
||||
{
|
||||
if (previous is MoveCommand moveCommand)
|
||||
if (previous is SetPositionCommand moveCommand)
|
||||
return moveCommand.Target != Target ? null : this;
|
||||
|
||||
return null;
|
Loading…
Reference in New Issue
Block a user