Browse Source

Remove IsAutoUpdatingEnabled property from ColorSlider

This was unused and is an unnecessary complexity
pull/8215/head
robloo 4 years ago
parent
commit
043b56c7da
  1. 21
      src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.Properties.cs
  2. 31
      src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs

21
src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.Properties.cs

@ -48,14 +48,6 @@ namespace Avalonia.Controls.Primitives
nameof(IsAlphaMaxForced),
true);
/// <summary>
/// Defines the <see cref="IsAutoUpdatingEnabled"/> property.
/// </summary>
public static readonly StyledProperty<bool> IsAutoUpdatingEnabledProperty =
AvaloniaProperty.Register<ColorSlider, bool>(
nameof(IsAutoUpdatingEnabled),
true);
/// <summary>
/// Defines the <see cref="IsSaturationValueMaxForced"/> property.
/// </summary>
@ -119,19 +111,6 @@ namespace Avalonia.Controls.Primitives
set => SetValue(IsAlphaMaxForcedProperty, value);
}
/// <summary>
/// Gets or sets a value indicating whether automatic background and foreground updates will be
/// calculated when the set color changes.
/// </summary>
/// <remarks>
/// This can be disabled for performance reasons when working with multiple sliders.
/// </remarks>
public bool IsAutoUpdatingEnabled
{
get => GetValue(IsAutoUpdatingEnabledProperty);
set => SetValue(IsAutoUpdatingEnabledProperty, value);
}
/// <summary>
/// Gets or sets a value indicating whether the saturation and value components are always forced to maximum values
/// when using the HSVA color model. Only component values other than <see cref="ColorComponent"/> will be changed.

31
src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs

@ -327,13 +327,10 @@ namespace Avalonia.Controls.Primitives
HsvColor = Color.ToHsv();
if (IsAutoUpdatingEnabled)
{
SetColorToSliderValues();
UpdateBackground();
}
SetColorToSliderValues();
UpdateBackground();
UpdatePseudoClasses();
OnColorChanged(new ColorChangedEventArgs(
change.GetOldValue<Color>(),
change.GetNewValue<Color>()));
@ -344,12 +341,8 @@ namespace Avalonia.Controls.Primitives
{
disableUpdates = true;
if (IsAutoUpdatingEnabled)
{
SetColorToSliderValues();
UpdateBackground();
}
SetColorToSliderValues();
UpdateBackground();
UpdatePseudoClasses();
disableUpdates = false;
@ -360,13 +353,10 @@ namespace Avalonia.Controls.Primitives
Color = HsvColor.ToRgb();
if (IsAutoUpdatingEnabled)
{
SetColorToSliderValues();
UpdateBackground();
}
SetColorToSliderValues();
UpdateBackground();
UpdatePseudoClasses();
OnColorChanged(new ColorChangedEventArgs(
change.GetOldValue<HsvColor>().ToRgb(),
change.GetNewValue<HsvColor>().ToRgb()));
@ -375,10 +365,7 @@ namespace Avalonia.Controls.Primitives
}
else if (change.Property == BoundsProperty)
{
if (IsAutoUpdatingEnabled)
{
UpdateBackground();
}
UpdateBackground();
}
else if (change.Property == ValueProperty ||
change.Property == MinimumProperty ||

Loading…
Cancel
Save