1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-31 14:25:10 +08:00

Merge pull request #31603 from peppy/input-amendments

Tidy up various input handling anomalies
This commit is contained in:
Dan Balasescu 2025-01-22 18:05:06 +09:00 committed by GitHub
commit 63e6b0e050
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 24 deletions

View File

@ -14,7 +14,6 @@ using osu.Framework.Input.Events;
using osu.Game.Input.Bindings;
using osu.Game.Overlays;
using osuTK;
using osuTK.Input;
namespace osu.Game.Graphics.UserInterfaceV2
{
@ -75,14 +74,6 @@ namespace osu.Game.Graphics.UserInterfaceV2
samplePopOut?.Play();
}
protected override bool OnKeyDown(KeyDownEvent e)
{
if (e.Key == Key.Escape)
return false; // disable the framework-level handling of escape key for conformity (we use GlobalAction.Back).
return base.OnKeyDown(e);
}
public virtual bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (e.Repeat)

View File

@ -111,25 +111,26 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected override bool OnKeyDown(KeyDownEvent e)
{
// Until the keys below are global actions, this will prevent conflicts with "seek between sample points"
// which has a default of ctrl+shift+arrows.
if (e.ShiftPressed)
return false;
if (e.ControlPressed)
{
switch (e.Key)
{
case Key.Left:
nudgeSelection(new Vector2(-1, 0));
return true;
return nudgeSelection(new Vector2(-1, 0));
case Key.Right:
nudgeSelection(new Vector2(1, 0));
return true;
return nudgeSelection(new Vector2(1, 0));
case Key.Up:
nudgeSelection(new Vector2(0, -1));
return true;
return nudgeSelection(new Vector2(0, -1));
case Key.Down:
nudgeSelection(new Vector2(0, 1));
return true;
return nudgeSelection(new Vector2(0, 1));
}
}
@ -151,7 +152,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// Move the current selection spatially by the specified delta, in gamefield coordinates (ie. the same coordinates as the blueprints).
/// </summary>
/// <param name="delta"></param>
private void nudgeSelection(Vector2 delta)
private bool nudgeSelection(Vector2 delta)
{
if (!nudgeMovementActive)
{
@ -162,12 +163,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
var firstBlueprint = SelectionHandler.SelectedBlueprints.FirstOrDefault();
if (firstBlueprint == null)
return;
return false;
// convert to game space coordinates
delta = firstBlueprint.ToScreenSpace(delta) - firstBlueprint.ToScreenSpace(Vector2.Zero);
SelectionHandler.HandleMovement(new MoveSelectionEvent<HitObject>(firstBlueprint, delta));
return true;
}
private void updatePlacementNewCombo()

View File

@ -245,6 +245,15 @@ namespace osu.Game.Screens.Menu
if (e.Repeat || e.ControlPressed || e.ShiftPressed || e.AltPressed || e.SuperPressed)
return false;
if (e.Key >= Key.F1 && e.Key <= Key.F35)
return false;
switch (e.Key)
{
case Key.Escape:
return false;
}
if (triggerInitialOsuLogo())
return true;

View File

@ -166,11 +166,6 @@ namespace osu.Game.Screens.Play
protected override void PopOut() => this.FadeOut(TRANSITION_DURATION, Easing.In);
// Don't let mouse down events through the overlay or people can click circles while paused.
protected override bool OnMouseDown(MouseDownEvent e) => true;
protected override bool OnMouseMove(MouseMoveEvent e) => true;
protected void AddButton(LocalisableString text, Color4 colour, Action? action)
{
var button = new Button