private void ManipulatorControl_MouseDown( object sender, MouseEventArgs e )
{
if ( e.Button == MouseButtons.Left )
{
// get click point relatively to manipulation area's center
int cX = e.X - areaMargin - areaRadius;
int cY = e.Y - areaMargin - areaRadius;
if ( isSquareLook )
{
if (
( cX <= areaRadius ) && ( cX >= -areaRadius ) &&
( cY <= areaRadius ) && ( cY >= -areaRadius ) )
{
tracking = true;
}
}
else
{
// check if the point is inside of manipulator
if ( Math.Sqrt( cX * cX + cY * cY ) <= areaRadius )
{
tracking = true;
}
}
if ( tracking )
{
manipulatatorX = (float) cX / areaRadius;
manipulatatorY = (float) -cY / areaRadius;
this.Capture = true;
this.Cursor = Cursors.Hand;
NotifyClients( );
// start timer, which is used to notify
// about manipulator's position change
ticksBeforeNotificiation = -1;
timer.Start( );
}
}
}