Beispiel #1
0
 /// <summary>
 /// We use the left mouse button to do exclusive capture of the mouse so we can drag and drag
 /// to rotate the cube without ever leaving the control
 /// </summary>
 /// <param name="args"></param>
 protected override void RaiseHwndLButtonDown(HwndMouseEventArgs args)
 {
     _originalPosition = HwndMouse.GetCursorPosition();
     CaptureMouse();
     HwndMouse.HideCursor();
     base.RaiseHwndLButtonDown(args);
 }
Beispiel #2
0
        /// <summary>
        /// Invoked when the mouse moves over the second viewport
        /// </summary>
        /// <param name="args"></param>
        protected override void RaiseHwndMouseMove(HwndMouseEventArgs args)
        {
            // If the left or right buttons are down, we adjust the yaw and pitch of the cube
            if (IsMouseCaptured)
            {
                var position = HwndMouse.GetCursorPosition();

                _yaw   += (float)(position.X - _originalPosition.X) * .01f;
                _pitch += (float)(position.Y - _originalPosition.Y) * .01f;

                HwndMouse.SetCursorPosition(_originalPosition);
            }

            base.RaiseHwndMouseMove(args);
        }
Beispiel #3
0
 protected override void RaiseHwndLButtonUp(HwndMouseEventArgs args)
 {
     HwndMouse.ShowCursor();
     ReleaseMouseCapture();
     base.RaiseHwndLButtonUp(args);
 }