Example #1
0
 protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
 {
     base.OnMouseLeftButtonUp(e);
     draggingStarted      = false;
     mouseDraggedLocation = centerPoint;
     DiamondPoint         = DiamondToolbox.CartesianToDiamond(new DoublePoint(0, 0), 100);
     if (JoystickMovedListeners != null)
     {
         JoystickMovedListeners(DiamondPoint);
     }
     e.Handled = true;
 }
Example #2
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            if (draggingStarted)
            {
                mouseDraggedLocation = e.GetPosition(this);
                var p = new DoublePoint(
                    map((int)mouseDraggedLocation.X, 0, (int)ActualWidth, 100, -100),
                    map((int)mouseDraggedLocation.Y, 0, (int)ActualHeight, 100, -100)
                    );
                DiamondPoint = DiamondToolbox.CartesianToDiamond(p, 100);

                if (JoystickMovedListeners != null)
                {
                    JoystickMovedListeners(DiamondPoint);
                }

                e.Handled = true;
            }
        }