Ejemplo n.º 1
0
 public override void OnMouseDown(MouseEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed || e.MiddleButton == MouseButtonState.Pressed)
     {
         clickPoint = MousePositionConverter.GetCursorPosition();
     }
 }
Ejemplo n.º 2
0
 public override void OnMouseMove(MouseEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed || e.MiddleButton == MouseButtonState.Pressed)
     {
         var point = MousePositionConverter.GetCursorPosition();
         ViewModelMain.Current.BitmapManager.ActiveDocument.ViewportPosition = new System.Windows.Point(
             point.X - clickPoint.X,
             point.Y - clickPoint.Y);
     }
 }
Ejemplo n.º 3
0
        public override void OnMouseMove(MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                double xPos = MousePositionConverter.GetCursorPosition().X;

                double rawPercentDifference   = (xPos - _startingX) / _pixelsPerZoomMultiplier; //negative - zoom out, positive - zoom in, linear
                double finalPercentDifference = Math.Pow(2, rawPercentDifference) * 100.0;      //less than 100 - zoom out, greater than 100 - zoom in
                Zoom(finalPercentDifference);
            }
        }
Ejemplo n.º 4
0
 public override void OnMouseUp(MouseEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Released && e.RightButton == MouseButtonState.Released &&
         _startingX == MousePositionConverter.GetCursorPosition().X)
     {
         if (Keyboard.Modifiers.HasFlag(ModifierKeys.Alt))
         {
             Zoom(85);
         }
         else
         {
             Zoom(115);
         }
     }
 }
Ejemplo n.º 5
0
        public Color GetColorUnderMouse()
        {
            System.Drawing.Color color;
            using (Bitmap bitmap = new Bitmap(1, 1))
            {
                using (Graphics graphics = Graphics.FromImage(bitmap))
                {
                    graphics.CopyFromScreen(MousePositionConverter.GetCursorPosition(), new Point(0, 0), new Size(1, 1));
                }

                color = bitmap.GetPixel(0, 0);
            }

            return(Color.FromArgb(color.A, color.R, color.G, color.B));
        }
Ejemplo n.º 6
0
    private void HandleMousePosition(Vector2 mousePosition)
    {
        transform.position = _positionConverter.GetCursorPosition(mousePosition, _distance);

        float speed = transform.position.x - _lastX;
        float right = 0.5f + speed * 1.5f;

        if (right - _lastRight > 0.02f)
        {
            right = _lastRight + 0.02f;
        }
        else if (_lastRight - right > 0.02f)
        {
            right = _lastRight - 0.02f;
        }

        _animator.SetFloat("right", right);
        _lastX     = transform.position.x;
        _lastRight = right;
    }
Ejemplo n.º 7
0
    private void HandleMousePosition(Vector2 mousePosition)
    {
        transform.position = _positionConverter.GetCursorPosition(mousePosition, _distance);
        transform.rotation = Quaternion.LookRotation(_camera.transform.forward, Vector3.up);

        float speed = transform.position.x - _lastX;
        float right = 0.5f + speed * 100;

        if (right - _lastRight > 0.02f)
        {
            right = _lastRight + 0.02f;
        }
        else if (_lastRight - right > 0.02f)
        {
            right = _lastRight - 0.02f;
        }

        _animator.SetFloat("right", right);
        _lastX     = transform.position.x;
        _lastRight = right;
    }
Ejemplo n.º 8
0
 public override void OnMouseDown(MouseEventArgs e)
 {
     _startingX = MousePositionConverter.GetCursorPosition().X;
     ViewModelMain.Current.ZoomPercentage = 100; //This resest the value, so callback in MainDrawingPanel can fire again later
 }