mirror of
https://github.com/ppy/osu.git
synced 2025-02-19 21:43:21 +08:00
Add keybind for distance grid spacing activation
This commit is contained in:
parent
04fb0f5e63
commit
521ec1a225
@ -79,6 +79,7 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(new[] { InputKey.F5 }, GlobalAction.EditorTestGameplay),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.H }, GlobalAction.EditorFlipHorizontally),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.J }, GlobalAction.EditorFlipVertically),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Alt }, GlobalAction.EditorDistanceSpacing),
|
||||
};
|
||||
|
||||
public IEnumerable<KeyBinding> InGameKeyBindings => new[]
|
||||
@ -301,5 +302,8 @@ namespace osu.Game.Input.Bindings
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorFlipVertically))]
|
||||
EditorFlipVertically,
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorDistanceSpacing))]
|
||||
EditorDistanceSpacing,
|
||||
}
|
||||
}
|
||||
|
@ -239,6 +239,11 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString EditorFlipVertically => new TranslatableString(getKey(@"editor_flip_vertically"), @"Flip selection vertically");
|
||||
|
||||
/// <summary>
|
||||
/// "Distance grid spacing (hold)"
|
||||
/// </summary>
|
||||
public static LocalisableString EditorDistanceSpacing => new TranslatableString(getKey(@"editor_distance_spacing"), @"Distance grid spacing (hold)");
|
||||
|
||||
/// <summary>
|
||||
/// "Toggle skin editor"
|
||||
/// </summary>
|
||||
|
@ -4,9 +4,11 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Overlays.Settings.Sections;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osuTK;
|
||||
@ -18,7 +20,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// </summary>
|
||||
/// <typeparam name="TObject">The base type of supported objects.</typeparam>
|
||||
[Cached(typeof(IDistanceSnapProvider))]
|
||||
public abstract class DistancedHitObjectComposer<TObject> : HitObjectComposer<TObject>, IDistanceSnapProvider
|
||||
public abstract class DistancedHitObjectComposer<TObject> : HitObjectComposer<TObject>, IDistanceSnapProvider, IKeyBindingHandler<GlobalAction>
|
||||
where TObject : HitObject
|
||||
{
|
||||
protected Bindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1.0)
|
||||
@ -75,21 +77,21 @@ namespace osu.Game.Rulesets.Edit
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||
{
|
||||
if (!DistanceSpacingMultiplier.Disabled && e.ControlPressed && e.AltPressed && !e.Repeat)
|
||||
if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing)
|
||||
{
|
||||
RightSideToolboxContainer.Expanded.Value = true;
|
||||
distanceSpacingScrollActive = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnKeyDown(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void OnKeyUp(KeyUpEvent e)
|
||||
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
||||
{
|
||||
if (!DistanceSpacingMultiplier.Disabled && distanceSpacingScrollActive && (!e.AltPressed || !e.ControlPressed))
|
||||
if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing)
|
||||
{
|
||||
RightSideToolboxContainer.Expanded.Value = false;
|
||||
distanceSpacingScrollActive = false;
|
||||
|
Loading…
Reference in New Issue
Block a user