mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 21:07:18 +09:00
add arrow short cut for skin editor
basically from `ComposeBlueprintContainer` because they have the same logic
This commit is contained in:
parent
6945c43e0d
commit
d1e27e8a69
@ -11,9 +11,12 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Skinning.Editor
|
namespace osu.Game.Skinning.Editor
|
||||||
{
|
{
|
||||||
@ -90,6 +93,47 @@ namespace osu.Game.Skinning.Editor
|
|||||||
base.AddBlueprintFor(item);
|
base.AddBlueprintFor(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
|
{
|
||||||
|
switch (e.Key)
|
||||||
|
{
|
||||||
|
case Key.Left:
|
||||||
|
moveSelection(new Vector2(-1, 0));
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case Key.Right:
|
||||||
|
moveSelection(new Vector2(1, 0));
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case Key.Up:
|
||||||
|
moveSelection(new Vector2(0, -1));
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case Key.Down:
|
||||||
|
moveSelection(new Vector2(0, 1));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Move the current selection spatially by the specified delta, in screen coordinates (ie. the same coordinates as the blueprints).
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="delta"></param>
|
||||||
|
private void moveSelection(Vector2 delta)
|
||||||
|
{
|
||||||
|
var firstBlueprint = SelectionHandler.SelectedBlueprints.FirstOrDefault();
|
||||||
|
|
||||||
|
if (firstBlueprint == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// convert to game space coordinates
|
||||||
|
delta = firstBlueprint.ToScreenSpace(delta) - firstBlueprint.ToScreenSpace(Vector2.Zero);
|
||||||
|
|
||||||
|
SelectionHandler.HandleMovement(new MoveSelectionEvent<ISkinnableDrawable>(firstBlueprint, delta));
|
||||||
|
}
|
||||||
|
|
||||||
protected override SelectionHandler<ISkinnableDrawable> CreateSelectionHandler() => new SkinSelectionHandler();
|
protected override SelectionHandler<ISkinnableDrawable> CreateSelectionHandler() => new SkinSelectionHandler();
|
||||||
|
|
||||||
protected override SelectionBlueprint<ISkinnableDrawable> CreateBlueprintFor(ISkinnableDrawable component)
|
protected override SelectionBlueprint<ISkinnableDrawable> CreateBlueprintFor(ISkinnableDrawable component)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user