/// <summary> /// gets the fader under the mouse and writes the mouseoffset /// to offset. if no fader is under the mouse, offset is (0,0) /// </summary> private List <ColorGradient.Point> GetFadersUnderMouse(Point location, ref Point offset, out bool focus) { focus = false; if (_blend != null) { using (Graphics gr = this.CreateGraphics()) { //check selection if (_selection != null && _selection.Count > 0) { //fader if (_selection.All(x => HitsSlider(gr, x.Position, x is AlphaPoint, false, location, ref _offset))) { return(_selection); } //focus if (_selection.All(x => HitsSlider(gr, _blend.GetFocusPosition(x), x is AlphaPoint, true, location, ref _offset))) { focus = true; return(_selection); } } List <ColorGradient.Point> rv = new List <ColorGradient.Point>(); //check other color faders double targetPosition = -1; Point rvOffset = Point.Empty; foreach (ColorPoint pnt in _blend.Colors.SortedArray()) { if (HitsSlider(gr, pnt.Position, false, false, location, ref rvOffset)) { if (targetPosition < 0) { targetPosition = pnt.Position; offset = rvOffset; } if (pnt.Position == targetPosition) { rv.Add(pnt); } } } return(rv); //check other alpha faders //foreach (AlphaPoint pnt in _blend.Alphas) // if (HitsSlider(gr, pnt.Position, true, false, location, ref offset)) // rv.Add(pnt); } } offset = Point.Empty; return(null); }
/// <summary> /// gets the fader under the mouse and writes the mouseoffset /// to offset. if no fader is under the mouse, offset is (0,0) /// </summary> private ColorGradient.Point GetFaderUnderMouse(Point location, ref Point offset, out bool focus) { focus = false; if (_blend != null) { using (Graphics gr = this.CreateGraphics()) { //check selection if (_selection != null) { //fader if (HitsSlider(gr, _selection.Position, _selection is AlphaPoint, false, location, ref _offset)) { return(_selection); } //focus if (HitsSlider(gr, _blend.GetFocusPosition(_selection), _selection is AlphaPoint, true, location, ref _offset)) { focus = true; return(_selection); } } //check other color faders foreach (ColorPoint pnt in _blend.Colors) { if (HitsSlider(gr, pnt.Position, false, false, location, ref offset)) { return(pnt); } } //check other alpha faders foreach (AlphaPoint pnt in _blend.Alphas) { if (HitsSlider(gr, pnt.Position, true, false, location, ref offset)) { return(pnt); } } } } offset = Point.Empty; return(null); }