예제 #1
0
        private void Knob_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            _startPos    = e.GetPosition(Base);
            _prevAileron = _prevElevator = 0;
            canvasWidth  = Base.ActualWidth - KnobBase.ActualWidth;
            canvasHeight = Base.ActualHeight - KnobBase.ActualHeight;
            Captured?.Invoke(this);
            Knob.CaptureMouse();

            centerKnob.Stop();
        }
예제 #2
0
 private void Knob_MouseDown(object sender, MouseButtonEventArgs e)
 {
     // Checks if the joystick was pressed.
     if (e.ChangedButton == MouseButton.Left)
     {
         // Update control point.
         startlPoint = e.GetPosition(this);
         Captured?.Invoke(this);
         Knob.CaptureMouse();
         centerknob.Stop();
     }
 }
예제 #3
0
 // Define the action when the mouse is down.
 private void Joystick_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (!mousePressed)
     {
         mousePressed = true;
         Knob.CaptureMouse();
         // Initilaze the begining point.
         startX = e.GetPosition(this).X;
         startY = e.GetPosition(this).Y;
         centerKnob.Stop();
     }
 }
예제 #4
0
 // This function update the appropriate variables when the MouseDown.
 private void Knob_MouseDown(object sender, MouseButtonEventArgs e)
 {
     // If left button was clicked.
     if (e.ChangedButton == MouseButton.Left)
     {
         startPoint.X = e.GetPosition(this).X;
         startPoint.Y = e.GetPosition(this).Y;
         canvasWidth  = BlackCircle.ActualWidth - KnobBase.ActualWidth / 2;
         canvasHeight = BlackCircle.ActualHeight - KnobBase.ActualHeight / 2;
         // Make sure that the KnobBase does not leave the Knob.
         Knob.CaptureMouse();
         centerKnob.Stop();
     }
 }
예제 #5
0
 private void Knob_MouseMove(object sender, MouseEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         Knob.CaptureMouse();
         double x = e.GetPosition(this).X - startPoint.X;
         double y = e.GetPosition(this).Y - startPoint.Y;
         if (Math.Sqrt(x * x + y * y) < ((Base.Width / 2) - (KnobBase.Width / 2)))
         {
             knobPosition.X = x;
             knobPosition.Y = y;
             Normal();
         }
     }
 }
예제 #6
0
 private void Knob_MouseDown(object sender, MouseButtonEventArgs e)
 {
     //check that the mouse pressed
     if (!MousePressed)
     {
         if (e.ChangedButton == MouseButton.Left)
         {
             //get the position of the knob
             firstPoint.X = e.GetPosition(this).X;
             firstPoint.Y = e.GetPosition(this).Y;
             Knob.CaptureMouse();
             MousePressed = true;
         }
     }
 }
예제 #7
0
        private void Knob_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Rudder   = 0;
            Elevator = 0;

            if (e.LeftButton == MouseButtonState.Pressed)
            {
                mouseDown     = true;
                startPosition = e.GetPosition(Base);
                centerKnob.Stop();

                Knob.CaptureMouse();
                width  = Base.ActualWidth - KnobBase.ActualWidth;
                height = Base.ActualHeight - KnobBase.ActualHeight;
            }
        }
예제 #8
0
 // Holds the logic for what to do when the mouse is being moved.
 private void Knob_MouseMove(object sender, MouseEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         Knob.CaptureMouse();
         // The postitions of the mouse.
         double newX = e.GetPosition(this).X - firstPoint.X;
         double newY = e.GetPosition(this).Y - firstPoint.Y;
         // Check to make sure that we don't allow the knob to go out of its border.
         if (Math.Sqrt(newX * newX + newY * newY) < (Base.Width / 2 - KnobBase.Width / 2) + 2)
         {
             knobPosition.X = newX;
             knobPosition.Y = newY;
         }
         // Normalize the values.
         Normalize();
     }
 }
예제 #9
0
 private void Knob_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     isPressed = true;
     Knob.CaptureMouse();
 }
예제 #10
0
 // on click event
 private void Knob_Clicked(object sender, MouseButtonEventArgs e)
 {
     // save the coords of the mouse when the knob was clicked
     _InitPos = e.GetPosition(this);
     Knob.CaptureMouse();
 }
예제 #11
0
 private void Knob_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     clickPoint = e.GetPosition(Base);
     Knob.CaptureMouse();
     centerKnob.Stop();
 }