Posts: 7
Threads: 3
Joined: Jun 2018
Reputation:
0
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
Posts: 766
Threads: 8
Joined: Sep 2009
Reputation:
58
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.
Andrej Benedik
Posts: 7
Threads: 3
Joined: Jun 2018
Reputation:
0
Thank you so much, it worked perfectly!