Accord.Controls.ManipulatorControl.ManipulatorControl_MouseMove C# (CSharp) Метод

ManipulatorControl_MouseMove() приватный Метод

private ManipulatorControl_MouseMove ( object sender, MouseEventArgs e ) : void
sender object
e MouseEventArgs
Результат void
        private void ManipulatorControl_MouseMove(object sender, MouseEventArgs e)
        {
            if (tracking)
            {
                // get mouse point relatively to manipulation area's center
                int cX = e.X - areaMargin - areaRadius;
                int cY = e.Y - areaMargin - areaRadius;

                if (isSquareLook)
                {
                    cX = System.Math.Min(areaRadius, System.Math.Max(-areaRadius, cX));
                    cY = System.Math.Min(areaRadius, System.Math.Max(-areaRadius, cY));
                }
                else
                {
                    // get distance from center
                    int cR = (int)System.Math.Sqrt(cX * cX + cY * cY);

                    // correct point if it is too far away
                    if (cR > areaRadius)
                    {
                        double coef = (double)areaRadius / cR;
                        cX = (int)(coef * cX);
                        cY = (int)(coef * cY);
                    }
                }

                manipulatatorX = (float)cX / areaRadius;
                manipulatatorY = (float)-cY / areaRadius;

                Invalidate();

                // notify user after 5 timer ticks
                ticksBeforeNotificiation = 5;
            }
        }