Editor - Don't call ApplyUpdateValue if nothing changed

Draggable number box - Fix values resetting to 1
This commit is contained in:
Robert committed 2022-07-17 12:10:58 +02:00
1 parent d114c37439
commit bd26f447c6
3 files changed
+6 -3

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ namespace Artemis.Core
#region Methods #region Methods
/// <summary> /// <summary>
/// Checks if the property already matches the desirec value or needs to be updated. /// Checks if the property already matches the desired value or needs to be updated.
/// </summary> /// </summary>
/// <typeparam name="T">Type of the property.</typeparam> /// <typeparam name="T">Type of the property.</typeparam>
/// <param name="storage">Reference to the backing-filed.</param> /// <param name="storage">Reference to the backing-filed.</param>
@@ -24,12 +24,12 @@ public class DraggableNumberBox : UserControl
/// <summary> /// <summary>
/// Defines the <see cref="Minimum" /> property. /// Defines the <see cref="Minimum" /> property.
/// </summary> /// </summary>
public static readonly StyledProperty<double> MinimumProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(Minimum), double.MinValue); public static readonly StyledProperty<double> MinimumProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(Minimum));
/// <summary> /// <summary>
/// Defines the <see cref="Maximum" /> property. /// Defines the <see cref="Maximum" /> property.
/// </summary> /// </summary>
public static readonly StyledProperty<double> MaximumProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(Maximum), double.MaxValue); public static readonly StyledProperty<double> MaximumProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(Maximum));
/// <summary> /// <summary>
/// Defines the <see cref="LargeChange" /> property. /// Defines the <see cref="LargeChange" /> property.
@@ -95,6 +95,9 @@ public abstract class PropertyInputViewModel<T> : PropertyInputViewModel
get => _inputValue; get => _inputValue;
set set
{ {
if (Equals(_inputValue, value))
return;
this.RaiseAndSetIfChanged(ref _inputValue, value); this.RaiseAndSetIfChanged(ref _inputValue, value);
ApplyInputValue(); ApplyInputValue();
} }