From 4fd4970ce7c0cab42830f2d061798bb7a2622421 Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 6 May 2023 21:38:15 -0400 Subject: [PATCH] Fix Hue in new ColorSpectrum coercion logic --- .../ColorSpectrum/ColorSpectrum.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorSpectrum/ColorSpectrum.cs b/src/Avalonia.Controls.ColorPicker/ColorSpectrum/ColorSpectrum.cs index 98a721ec91..6683346eeb 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorSpectrum/ColorSpectrum.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorSpectrum/ColorSpectrum.cs @@ -683,7 +683,12 @@ namespace Avalonia.Controls.Primitives case ColorSpectrumComponents.ValueSaturation: case ColorSpectrumComponents.SaturationValue: - newHsv.H = 1.0; + // Hue is mathematically NOT a special case; however, is one conceptually. + // It doesn't make sense to change the selected Hue value, so why is it set here? + // Setting to 360.0 is equivalent to the max set for other components and is + // internally wrapped back to 0.0 (since 360 degrees = 0 degrees). + // This means effectively there is no change to the hue component value. + newHsv.H = 360.0; break; }