public ColorPicker(VisualDirection direction, float knobWidth, float minVisualLength, Color color, bool preview, Reaction<Color> changed) : base(preview ? direction : direction.Opposite (), HAlign.Left, VAlign.Top, true, false, Enumerable.Empty<Control> ()) { Changed = changed; _hue = ColorSlider.Hue (direction, knobWidth, minVisualLength, color, React.By<float> (ChangeHue)); _saturation = ColorSlider.Saturation (direction, knobWidth, minVisualLength, color, React.By<float> (ChangeSaturation)); _brightness = ColorSlider.Brightness (direction, knobWidth, minVisualLength, color, React.By<float> (ChangeBrightness)); var controls = EnumerableExt.Enumerate<Control> (_hue, _saturation, _brightness); var contents = preview ? EnumerableExt.Enumerate ( new Container (direction, HAlign.Center, VAlign.Center, false, false, new Container (direction.Opposite (), HAlign.Left, VAlign.Top, false, false, controls), Label.ColorPreview (() => _value, new SizeF (3.5f * knobWidth, 3.5f * knobWidth)))) : controls; Controls.AddRange (contents.Select (c => new Tuple<Control, Reaction<Control>> (c, null))); }
public ColorPicker(VisualDirection direction, float knobWidth, float minVisualLength, Color color, bool preview, Reaction <Color> changed) : base(preview ? direction : direction.Opposite(), HAlign.Left, VAlign.Top, true, false, Enumerable.Empty <Control> ()) { Changed = changed; _hue = ColorSlider.Hue(direction, knobWidth, minVisualLength, color, React.By <float> (ChangeHue)); _saturation = ColorSlider.Saturation(direction, knobWidth, minVisualLength, color, React.By <float> (ChangeSaturation)); _brightness = ColorSlider.Brightness(direction, knobWidth, minVisualLength, color, React.By <float> (ChangeBrightness)); var controls = EnumerableExt.Enumerate <Control> (_hue, _saturation, _brightness); var contents = preview ? EnumerableExt.Enumerate( new Container(direction, HAlign.Center, VAlign.Center, false, false, new Container(direction.Opposite(), HAlign.Left, VAlign.Top, false, false, controls), Label.ColorPreview(() => _value, new SizeF(3.5f * knobWidth, 3.5f * knobWidth)))) : controls; Controls.AddRange(contents.Select(c => new Tuple <Control, Reaction <Control> > (c, null))); }