|
@@ -1,4 +1,5 @@
|
|
|
-using System;
|
|
|
+using PixiEditor.Models.Controllers.Shortcuts;
|
|
|
+using System;
|
|
|
using System.Text.RegularExpressions;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
@@ -13,20 +14,28 @@ namespace PixiEditor.Views
|
|
|
{
|
|
|
// Using a DependencyProperty as the backing store for Value. This enables animation, styling, binding, etc...
|
|
|
public static readonly DependencyProperty ValueProperty =
|
|
|
- DependencyProperty.Register("Value", typeof(float), typeof(NumberInput),
|
|
|
+ DependencyProperty.Register(
|
|
|
+ "Value",
|
|
|
+ typeof(float),
|
|
|
+ typeof(NumberInput),
|
|
|
new PropertyMetadata(0f, OnValueChanged));
|
|
|
|
|
|
// Using a DependencyProperty as the backing store for Min. This enables animation, styling, binding, etc...
|
|
|
public static readonly DependencyProperty MinProperty =
|
|
|
- DependencyProperty.Register("Min", typeof(float), typeof(NumberInput),
|
|
|
+ DependencyProperty.Register(
|
|
|
+ "Min",
|
|
|
+ typeof(float),
|
|
|
+ typeof(NumberInput),
|
|
|
new PropertyMetadata(float.NegativeInfinity));
|
|
|
|
|
|
// Using a DependencyProperty as the backing store for Max. This enables animation, styling, binding, etc...
|
|
|
public static readonly DependencyProperty MaxProperty =
|
|
|
- DependencyProperty.Register("Max", typeof(float), typeof(NumberInput),
|
|
|
+ DependencyProperty.Register(
|
|
|
+ "Max",
|
|
|
+ typeof(float),
|
|
|
+ typeof(NumberInput),
|
|
|
new PropertyMetadata(float.PositiveInfinity));
|
|
|
|
|
|
-
|
|
|
public NumberInput()
|
|
|
{
|
|
|
InitializeComponent();
|
|
@@ -53,8 +62,8 @@ namespace PixiEditor.Views
|
|
|
|
|
|
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
|
{
|
|
|
- NumberInput input = (NumberInput) d;
|
|
|
- input.Value = Math.Clamp((float) e.NewValue, input.Min, input.Max);
|
|
|
+ NumberInput input = (NumberInput)d;
|
|
|
+ input.Value = Math.Clamp((float)e.NewValue, input.Min, input.Max);
|
|
|
}
|
|
|
|
|
|
private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
|