mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 04:53:29 +01:00
code cleanup
This commit is contained in:
parent
a76c14b243
commit
1067055bb5
4 changed files with 10 additions and 15 deletions
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using MLEM.Ui.Style;
|
||||
|
||||
|
|
|
@ -34,12 +34,6 @@ namespace MLEM.Extensions {
|
|||
/// </summary>
|
||||
public static class ColorHelper {
|
||||
|
||||
/// <inheritdoc cref="ColorExtensions.Invert"/>
|
||||
[Obsolete("This method has been moved to ColorExtensions.Invert in 5.1.0")]
|
||||
public static Color Invert(this Color color) {
|
||||
return ColorExtensions.Invert(color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses a hexadecimal number into an rgba color.
|
||||
/// The number should be in the format <c>0xaarrggbb</c>.
|
||||
|
|
Loading…
Reference in a new issue