AB4D Forum

Full Version: MouseCameraController rotation with left button pressed OR with right button pressed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm using the MouseCameraController to move/rotate a target position camera into a Viewport3D.

My problem is that I would like to enable camera rotation with mouse left button click OR with mouse right button click at the same time.

Is this a FEATURE that you're going to introduce in some future release?

Thank you for your time.

Best.
Luigi Oliveto
With using PreviewMouseDown event it is possible to check which button is pressed before this event gets processed by the MouseCameraController. This means that it is possible to update the RotateCameraConditions based on the currently pressed mouse button:

            ViewportBorder.PreviewMouseDown += delegate(object sender, MouseButtonEventArgs e)
            {
                if (e.LeftButton == MouseButtonState.Pressed && e.RightButton == MouseButtonState.Released)
                {
                    MouseCameraController1.RotateCameraConditions = MouseCameraController.MouseAndKeyboardConditions.LeftMouseButtonPressed;
                }
                else if (e.LeftButton == MouseButtonState.Released && e.RightButton == MouseButtonState.Pressed)
                {
                    MouseCameraController1.RotateCameraConditions = MouseCameraController.MouseAndKeyboardConditions.RightMouseButtonPressed;
                }
                else if (e.LeftButton == MouseButtonState.Pressed && e.RightButton == MouseButtonState.Pressed)
                {
                    MouseCameraController1.RotateCameraConditions = MouseCameraController.MouseAndKeyboardConditions.LeftMouseButtonPressed | MouseCameraController.MouseAndKeyboardConditions.RightMouseButtonPressed;
                }
            };

With the new version of Ab3d.PowerToys (I am planning to release it this week or in the beginning of the next week) it will be also possible to override the IsMouseButtonsConditionTrue and IsKeyboardConditionTrue methods and provide your own logic there.
Thank you so much, it worked perfectly!