AdvancedColorPicker.SaturationBrightnessPickerView.HandleTouches C# (CSharp) Method

HandleTouches() private method

private HandleTouches ( MonoTouch touches, UIEvent evt ) : void
touches MonoTouch
evt UIEvent
return void
        private void HandleTouches(MonoTouch.Foundation.NSSet touches, UIEvent evt)
        {
            var touch = (UITouch)evt.TouchesForView (this).AnyObject;
            PointF pos;
            pos = touch.LocationInView (this);

            float w = Frame.Size.Width;
            float h = Frame.Size.Height;

            if (pos.X < 0)
                saturation = 0;
            else if (pos.X > w)
                saturation = 1;
            else
                saturation = pos.X / w;

            if (pos.Y < 0)
                brightness = 1;
            else if (pos.Y > h)
                brightness = 0;
            else
                brightness = 1 - (pos.Y / h);

            if (ColorPicked != null) {
                ColorPicked ();
            }
        }