diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-03-31 12:25:56 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-03-31 12:25:56 +0200 |
| commit | 135ced0e0a94ae759fba5fec7c0f35ec9be28231 (patch) | |
| tree | bf7704783131ed55d89ab1dd8183458584c10f03 /src/GraphicObjects/HueSelector.cs | |
| parent | d7457dc87ec4a282ac58a5617f149164a1421a64 (diff) | |
convert hsv to integer in color pickerIFaceByParenting
Diffstat (limited to 'src/GraphicObjects/HueSelector.cs')
| -rw-r--r-- | src/GraphicObjects/HueSelector.cs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/GraphicObjects/HueSelector.cs b/src/GraphicObjects/HueSelector.cs index 67f4ec6e..6c104d01 100644 --- a/src/GraphicObjects/HueSelector.cs +++ b/src/GraphicObjects/HueSelector.cs @@ -43,6 +43,8 @@ namespace Crow Orientation _orientation; double hue; + const double div = 255.0; + const double colDiv = 1.0 / div; [XmlAttributeAttribute][DefaultValue(Orientation.Horizontal)] public virtual Orientation Orientation @@ -58,11 +60,11 @@ namespace Crow } [XmlAttributeAttribute()] public virtual double Hue { - get { return hue; } + get { return Math.Round(hue * div); } set { - if (hue == value) + if (Hue == value) return; - hue = value; + hue = value * colDiv; notifyHueChanged (); updateMousePosFromHue (); RegisterForRedraw (); @@ -147,7 +149,7 @@ namespace Crow mousePos.Y = (int)Math.Floor(hue * (double)ClientRectangle.Height); } void notifyHueChanged(){ - NotifyValueChanged ("Hue", hue); + NotifyValueChanged ("Hue", Hue); NotifyValueChanged ("HueColor", new SolidColor (Color.FromHSV (hue))); } } |