mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 16:47:46 +08:00
Merge pull request #24070 from peppy/fix-flip-undo-states
Trigger state change when flipping via hotkey in the editor
This commit is contained in:
commit
81e759cb6b
@ -133,6 +133,32 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddAssert("objects reverted to original position", () => addedObjects[0].Position == new Vector2(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGlobalFlipHotkeys()
|
||||
{
|
||||
HitCircle addedObject = null;
|
||||
|
||||
AddStep("add hitobjects", () => EditorBeatmap.Add(addedObject = new HitCircle { StartTime = 100 }));
|
||||
|
||||
AddStep("select objects", () => EditorBeatmap.SelectedHitObjects.Add(addedObject));
|
||||
|
||||
AddStep("flip horizontally across playfield", () =>
|
||||
{
|
||||
InputManager.PressKey(Key.ControlLeft);
|
||||
InputManager.Key(Key.H);
|
||||
InputManager.ReleaseKey(Key.ControlLeft);
|
||||
});
|
||||
AddAssert("objects flipped horizontally", () => addedObject.Position == new Vector2(OsuPlayfield.BASE_SIZE.X, 0));
|
||||
|
||||
AddStep("flip vertically across playfield", () =>
|
||||
{
|
||||
InputManager.PressKey(Key.ControlLeft);
|
||||
InputManager.Key(Key.J);
|
||||
InputManager.ReleaseKey(Key.ControlLeft);
|
||||
});
|
||||
AddAssert("objects flipped vertically", () => addedObject.Position == OsuPlayfield.BASE_SIZE);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBasicSelect()
|
||||
{
|
||||
|
@ -160,13 +160,23 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
if (e.Repeat)
|
||||
return false;
|
||||
|
||||
bool handled;
|
||||
|
||||
switch (e.Action)
|
||||
{
|
||||
case GlobalAction.EditorFlipHorizontally:
|
||||
return HandleFlip(Direction.Horizontal, true);
|
||||
ChangeHandler?.BeginChange();
|
||||
handled = HandleFlip(Direction.Horizontal, true);
|
||||
ChangeHandler?.EndChange();
|
||||
|
||||
return handled;
|
||||
|
||||
case GlobalAction.EditorFlipVertically:
|
||||
return HandleFlip(Direction.Vertical, true);
|
||||
ChangeHandler?.BeginChange();
|
||||
handled = HandleFlip(Direction.Vertical, true);
|
||||
ChangeHandler?.EndChange();
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user