Пример #1
0
 private void MainImage_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (DataContext is ViewModel vm)
     {
         if (e.LeftButton == MouseButtonState.Pressed)
         {
             if (e.ClickCount == 2)
             {
                 vm.SolidMode = false;
                 vm.SetRotation(0.0, 0.0);
             }
             else if (e.ClickCount < 2)
             {
                 _draggingMode = DraggingMode.Left;
                 _x            = vm.CenterX;
                 _y            = vm.CenterY;
                 _dragStart    = e.GetPosition(MainImage);
                 MainImage.CaptureMouse();
             }
         }
         else if (e.RightButton == MouseButtonState.Pressed)
         {
             _draggingMode = DraggingMode.Right;
             _x            = vm.Yaw;
             _y            = vm.Pitch;
             _dragStart    = e.GetPosition(MainImage);
             MainImage.CaptureMouse();
         }
         else
         {
             _draggingMode = DraggingMode.None;
             MainImage.ReleaseMouseCapture();
         }
     }
 }