diff --git a/CHANGELOG.md b/CHANGELOG.md index 7297e1b..673bc39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ Improvements - Improved NinePatch memory performance - Moved sound-related classes into Sound namespace - Added customizable overloads for Keybind, Combination and GenericInput ToString methods -- Added ColorExtensions.Invert and made ColorHelper.Invert obsolete +- Moved ColorHelper.Invert to ColorExtensions.Invert - Removed LINQ Any and All usage in various methods to improve memory usage Fixes diff --git a/MLEM.Ui/Elements/TextField.cs b/MLEM.Ui/Elements/TextField.cs index 34af66a..8d187f1 100644 --- a/MLEM.Ui/Elements/TextField.cs +++ b/MLEM.Ui/Elements/TextField.cs @@ -1,6 +1,5 @@ using System; using System.IO; -using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -184,12 +183,8 @@ namespace MLEM.Ui.Elements { this.SetText(text, true); MlemPlatform.EnsureExists(); - this.OnPressed += async e => { - var title = this.MobileTitle ?? this.PlaceholderText; - var result = await MlemPlatform.Current.OpenOnScreenKeyboard(title, this.MobileDescription, this.Text, false); - if (result != null) - this.SetText(result.Replace('\n', ' '), true); - }; + + this.OnPressed += OnPressed; this.OnTextInput += (element, key, character) => { if (!this.IsSelected || this.IsHidden) return; @@ -206,6 +201,13 @@ namespace MLEM.Ui.Elements { }; this.OnDeselected += e => this.CaretPos = 0; this.OnSelected += e => this.CaretPos = this.text.Length; + + async void OnPressed(Element e) { + var title = this.MobileTitle ?? this.PlaceholderText; + var result = await MlemPlatform.Current.OpenOnScreenKeyboard(title, this.MobileDescription, this.Text, false); + if (result != null) + this.SetText(result.Replace('\n', ' '), true); + } } private void HandleTextChange(bool textChanged = true) { diff --git a/MLEM.Ui/Elements/Tooltip.cs b/MLEM.Ui/Elements/Tooltip.cs index 1c5335e..c3d4ad3 100644 --- a/MLEM.Ui/Elements/Tooltip.cs +++ b/MLEM.Ui/Elements/Tooltip.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using Microsoft.Xna.Framework; using MLEM.Ui.Style; diff --git a/MLEM/Extensions/ColorExtensions.cs b/MLEM/Extensions/ColorExtensions.cs index ae94fa3..2c5abbe 100644 --- a/MLEM/Extensions/ColorExtensions.cs +++ b/MLEM/Extensions/ColorExtensions.cs @@ -34,12 +34,6 @@ namespace MLEM.Extensions { /// public static class ColorHelper { - /// - [Obsolete("This method has been moved to ColorExtensions.Invert in 5.1.0")] - public static Color Invert(this Color color) { - return ColorExtensions.Invert(color); - } - /// /// Parses a hexadecimal number into an rgba color. /// The number should be in the format 0xaarrggbb.