1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-14 04:22:34 +08:00

Compare commits

...

3 Commits

4 changed files with 23 additions and 33 deletions
@@ -1,17 +1,15 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Input;
namespace osu.Game.Graphics.UserInterface
{
public partial class OsuNumberBox : OsuTextBox
{
public OsuNumberBox()
{
InputProperties = new TextInputProperties(TextInputType.Number, false);
SelectAllOnFocus = true;
}
protected override bool CanAddCharacter(char character) => char.IsAsciiDigit(character);
}
}
@@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using System.Globalization;
using osu.Framework.Input;
namespace osu.Game.Graphics.UserInterfaceV2
{
@@ -20,11 +19,6 @@ namespace osu.Game.Graphics.UserInterfaceV2
{
public bool AllowDecimals { get; init; }
public InnerNumberBox()
{
InputProperties = new TextInputProperties(TextInputType.Number, false);
}
protected override bool CanAddCharacter(char character)
=> char.IsAsciiDigit(character) || (AllowDecimals && CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator.Contains(character));
}
@@ -5,7 +5,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
namespace osu.Game.Overlays.Settings
{
@@ -67,11 +66,6 @@ namespace osu.Game.Overlays.Settings
private partial class OutlinedNumberBox : OutlinedTextBox
{
public OutlinedNumberBox()
{
InputProperties = new TextInputProperties(TextInputType.Number, false);
}
protected override bool CanAddCharacter(char character) => char.IsAsciiDigit(character);
public new void NotifyInputError() => base.NotifyInputError();
+21 -17
View File
@@ -1176,33 +1176,37 @@ namespace osu.Game.Screens.Select
protected override bool IsDragging => base.IsDragging || absoluteScrolling;
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
protected override bool OnMouseDown(MouseDownEvent e)
{
switch (e.Action)
if (e.Button == MouseButton.Right)
{
case GlobalAction.AbsoluteScrollSongList:
// The default binding for absolute scroll is right mouse button.
// To avoid conflicts with context menus, disallow absolute scroll completely if it looks like things will fall over.
if (e.CurrentState.Mouse.Buttons.Contains(MouseButton.Right)
&& GetContainingInputManager()!.HoveredDrawables.OfType<IHasContextMenu>().Any())
return false;
// The default binding for absolute scroll is right mouse button.
// To avoid conflicts with context menus, disallow absolute scroll completely if it looks like things will fall over.
if (e.CurrentState.Mouse.Buttons.Contains(MouseButton.Right)
&& GetContainingInputManager()!.HoveredDrawables.OfType<IHasContextMenu>().Any())
return false;
ScrollToAbsolutePosition(e.CurrentState.Mouse.Position);
absoluteScrolling = true;
return true;
ScrollToAbsolutePosition(e.CurrentState.Mouse.Position);
absoluteScrolling = true;
return true;
}
return base.OnMouseDown(e);
}
protected override void OnMouseUp(MouseUpEvent e)
{
absoluteScrolling = false;
base.OnMouseUp(e);
}
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
return false;
}
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
switch (e.Action)
{
case GlobalAction.AbsoluteScrollSongList:
absoluteScrolling = false;
break;
}
}
protected override bool OnMouseMove(MouseMoveEvent e)