1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Modifiers - Cannot input negative values - closes #519

This commit is contained in:
SpoinkyNL 2021-02-02 19:32:22 +01:00
parent bd6c93b292
commit 1c10eb8aa4
2 changed files with 8 additions and 4 deletions

View File

@ -14,9 +14,12 @@ namespace Artemis.UI.DefaultTypes.DataModel.Input
public void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
{
string seperator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
Regex regex = new("^[" + seperator + "][0-9]+$|^[0-9]*[" + seperator + "]{0,1}[0-9]*$");
e.Handled = !regex.IsMatch(e.Text);
if (e.Text != "-")
{
string seperator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
Regex regex = new("^[" + seperator + "][0-9]+$|^[0-9]*[" + seperator + "]{0,1}[0-9]*$");
e.Handled = !regex.IsMatch(e.Text);
}
}
}
}

View File

@ -64,6 +64,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
{
if (!SetAndNotify(ref _selectedDataBindingMode, value)) return;
ApplyDataBindingMode();
Update();
}
}
@ -145,6 +146,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
if (Registration.DataBinding == null)
{
IsDataBindingEnabled = false;
IsEasingTimeEnabled = false;
return;
}
@ -199,7 +201,6 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
Registration.DataBinding.ChangeDataBindingMode(SelectedDataBindingMode);
CreateDataBindingModeModeViewModel();
_profileEditorService.UpdateSelectedProfileElement();
}