From 0b9c41c94e342e11c5d73614a3d6cd4b93db9c52 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jan 2025 02:45:13 +0900 Subject: [PATCH] Fix broken text boxes in editor --- osu.Game/Graphics/UserInterface/OsuNumberBox.cs | 8 ++++---- osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs | 6 ------ osu.Game/Overlays/Settings/SettingsNumberBox.cs | 6 +----- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuNumberBox.cs b/osu.Game/Graphics/UserInterface/OsuNumberBox.cs index 991ab6798f..db4b7b2ab3 100644 --- a/osu.Game/Graphics/UserInterface/OsuNumberBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuNumberBox.cs @@ -1,17 +1,17 @@ // Copyright (c) ppy Pty Ltd . 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 { + protected override bool AllowIme => false; + public OsuNumberBox() { - InputProperties = new TextInputProperties(TextInputType.Number, false); - SelectAllOnFocus = true; } + + protected override bool CanAddCharacter(char character) => char.IsAsciiDigit(character); } } diff --git a/osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs b/osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs index 61d3b3fc31..c3256e0038 100644 --- a/osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs +++ b/osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs @@ -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)); } diff --git a/osu.Game/Overlays/Settings/SettingsNumberBox.cs b/osu.Game/Overlays/Settings/SettingsNumberBox.cs index 2548f3c87b..fbcdb4a968 100644 --- a/osu.Game/Overlays/Settings/SettingsNumberBox.cs +++ b/osu.Game/Overlays/Settings/SettingsNumberBox.cs @@ -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,10 +66,7 @@ namespace osu.Game.Overlays.Settings private partial class OutlinedNumberBox : OutlinedTextBox { - public OutlinedNumberBox() - { - InputProperties = new TextInputProperties(TextInputType.Number, false); - } + protected override bool AllowIme => false; protected override bool CanAddCharacter(char character) => char.IsAsciiDigit(character);