I'm building a WPF app that has some 3D objects in view and the view should be able to be panned and rotated. I'm using HelixViewport3D for this from the HelixToolkit NuGet pakcage, HelixToolkit.Wpf library. The view should be rotated by holding down the mouse wheel and moving the mouse around. I'm using the left click for panning and the right click is for showing tooltips of objects in the view.
The .xaml snippet for the viewport:
<helix:HelixViewport3D x:Name="viewport" ClipToBounds="True" ShowViewCube="False">
<helix:HelixViewport3D.Camera>
<PerspectiveCamera Position="3 2 6" LookDirection="0 -2 -3"></PerspectiveCamera>
</helix:HelixViewport3D.Camera>
...
..
.
In the MainWindow constructor:
viewport.RotateGesture = new MouseGesture(MouseAction.MiddleClick);
viewport.PanGesture = new MouseGesture(MouseAction.LeftClick);
Doing this pans the camera when i hold down the mouse wheel in stead of rotating it. The panning on left click works fine.
If I use MouseAction.WheelClick
in stead of MouseAction.MiddleClick
, then scrolling the mouse wheel will initiate the rotating as i move my mouse around, as I would like it to when i hold down the wheel, and only stops tracking the mouse and rotating when i click the mouse wheel. This also removes the zooming feature since it is apparently overwritten by this new gesture. Holding down the wheel and moving the mouse around still pans the camera.
If I use MouseAction.RightClick
it works perfectly fine with the right mouse click, but as I said this feature needs to be implemented with the mouse wheel click and not the right click.
Note: Holding down the mouse wheel ALWAYS pans the camera.
Is there a way to rotate the camera with the mouse wheel click as was intended?
Another thing that's seemingly unrelated to my current problem but is very strange, when I double click the mouse wheel, regardless of the gestures, the camera jumps to some strange location and shifts to an awkward viewing angle. It always goes to the exact same position and angle regardless of where it was then the wheel was double clicked. Not sure if this has anything to do with my problem though.