public void OnMouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
var mouseState = Mouse.GetState();
var keyboardState = Keyboard.GetState();
var currentMouseCoordinate = new Vector2(e.X, e.Y);
if (keyboardState.IsKeyDown(Key.ShiftLeft) && (mouseState[MouseButton.Middle] || (mouseState[MouseButton.Left] && keyboardState[Key.ControlLeft])))
{
var d = 5;
var previousMouseWorldCoordinate = Maths.Project(ViewMatrix, Viewport.ProjectionMatrix, previousMouseCoordinate, (Rectangle)Viewport, Maths.ProjectionTarget.View);
var mouseWorldCoordinate = Maths.Project(ViewMatrix, ProjectionMatrix, currentMouseCoordinate, (Rectangle)Viewport, Maths.ProjectionTarget.View);
var delta = mouseWorldCoordinate - previousMouseWorldCoordinate;
delta *= d;
panTrack.Update(delta.X, delta.Y);
}
else if (keyboardState.IsKeyDown(Key.AltLeft) && (mouseState[MouseButton.Middle] || (mouseState[MouseButton.Left] && keyboardState[Key.ControlLeft])))
{
var previousMouseWorldCoordinate = Maths.Project(ViewMatrix, Viewport.ProjectionMatrix, previousMouseCoordinate, (Rectangle)Viewport, Maths.ProjectionTarget.View);
var mouseWorldCoordinate = Maths.Project(ViewMatrix, ProjectionMatrix, currentMouseCoordinate, (Rectangle)Viewport, Maths.ProjectionTarget.View);
var delta = mouseWorldCoordinate - previousMouseWorldCoordinate;
delta *= 10;
zoomTrack.Update(delta.Y);
}
else if (mouseState[MouseButton.Middle] || (mouseState[MouseButton.Left] && keyboardState[Key.ControlLeft]))
{
var delta = currentMouseCoordinate - previousMouseCoordinate;
//delta *= 10;
orbitTrack.Update(delta.X, delta.Y);
}
if (this.MouseMove != null) this.MouseMove(this, new MouseEventArgs(this, new Vector2(e.X, e.Y), default(Vector3), e.Button));
previousMouseCoordinate = currentMouseCoordinate;
}