public void MouseMove(MouseEventInfo e, KeyEventInfo k, Vector2 previousLocation) { var position = e.FullPosition; var movement = new Vector2(position.X, position.Y) - previousLocation; if (e.RightButton == ButtonState.Pressed && !_camera.LockRotation) { if (k.KeyCtrl) { _camera._targetDistance *= 1 - movement.Y * -5 * 0.001f; } else { if (!k.IsKeyDown("y")) { _camera.RotationX += movement.Y * rotFactorX; } if (!k.IsKeyDown("x")) { _camera.RotationY += movement.X * rotFactorY; } //Reset direction _camera.Direction = Camera.FaceDirection.Any; } } if (e.LeftButton == ButtonState.Pressed) { Pan(movement.X * _camera.PanSpeed, movement.Y * _camera.PanSpeed); } _camera.UpdateMatrices(); }
public void MouseClick(MouseEventInfo e, KeyEventInfo k) { if (k.KeyCtrl && e.RightButton == ButtonState.Pressed && _camera.Depth != _camera.ZFar) { // _camera.TargetPosition = -_camera.CoordFor(e.X, e.Y, _camera.Depth); } }
public int OnMouseDown(GLContext context, MouseEventInfo e) { IsActive = CheckSelectedAxes(context, new Vector2(e.Position.X, e.Position.Y)); Console.WriteLine($"IsActive {IsActive}"); m_hasSetMouseOffset = false; m_translateOffset = Vector3.Zero; return(IsActive ? 1 : 0); }
public int OnMouseMove(GLContext context, MouseEventInfo e) { if (!IsActive) { CheckSelectedAxes(context, new Vector2(e.X, e.Y)); } if (IsActive) { return(DragMouse(context, new Vector2(e.X, e.Y))); } return(0); }
public void MouseWheel(MouseEventInfo e, KeyEventInfo k) { if (k.KeyCtrl) { float delta = -e.Delta * Math.Min(0.1f, _camera.Depth / 500f); delta *= _camera.TargetDistance; Vector2 normCoords = OpenGLHelper.NormMouseCoords(e.X, e.Y, _camera.Width, _camera.Height); Vector3 vec = _camera.InverseRotationMatrix.Row0 * -normCoords.X * delta * _camera.FactorX + _camera.InverseRotationMatrix.Row1 * normCoords.Y * delta * _camera.FactorY + _camera.InverseRotationMatrix.Row2 * delta; _camera.TargetPosition += vec; } else { Zoom(e.Delta * 0.1f * _camera.ZoomSpeed, true); } }
public void MouseWheel(MouseEventInfo e, KeyEventInfo k) { if (k.KeyShift) { float amount = e.Delta * 0.1f; _camera.KeyMoveSpeed += amount; } else { float delta = (e.Delta * Math.Min(k.KeyShift ? 0.04f : 0.01f, _camera.Depth / 500f)); Vector3 vec; Vector2 normCoords = OpenGLHelper.NormMouseCoords(e.X, e.Y, _camera.Width, _camera.Height); vec.X = (-normCoords.X * delta) * _camera.FactorX; vec.Y = (normCoords.Y * delta) * _camera.FactorY; vec.Z = delta; _camera.TargetPosition -= Vector3.Transform(_camera.InverseRotationMatrix, vec); } }
public void MouseMove(MouseEventInfo e, KeyEventInfo k, Vector2 previousLocation) { var position = new Vector2(e.FullPosition.X, e.FullPosition.Y); var movement = position - previousLocation; if ((e.LeftButton == ButtonState.Pressed || e.RightButton == ButtonState.Pressed) && !_camera.LockRotation) { if (k.KeyCtrl) { float delta = ((float)movement.Y * -5 * Math.Min(0.01f, _camera.Depth / 500f)); Vector3 vec; vec.X = 0; vec.Y = 0; vec.Z = delta; _camera.TargetPosition += Vector3.Transform(_camera.InverseRotationMatrix, vec); } else { if (!k.IsKeyDown("y")) { _camera.RotationX += movement.Y * rotFactorX; } if (!k.IsKeyDown("x")) { _camera.RotationY += movement.X * rotFactorY; } //Reset direction _camera.Direction = Camera.FaceDirection.Any; } } if (e.LeftButton == ButtonState.Pressed) { } }
public void OnMouseMove(MouseEventInfo e) { CurrentMousePoint = new Vector2(e.X, Height - e.Y); }
public void OnMouseDown(MouseEventInfo e) { MouseOrigin = new Vector2(e.X, e.Y); }
public int OnMouseUp(GLContext context, MouseEventInfo e) { IsActive = false; return(0); }
public void MouseClick(MouseEventInfo e, KeyEventInfo k) { }