Hi all,
I found that below events can be used to to control the view of the render image, but is there a way to block some events or to switch the event for example Left Mouse + Shift: Pan events to right mouse and also want to block Left Mouse + Ctrl/Alt: Spin events?
/** Left Mouse: Rotate /
/* Left Mouse + Shift: Pan /
/* Left Mouse + Ctrl/Alt: Spin /
/* Left Mouse + Shift + Ctrl/Alt: Dolly /
/* Mouse Wheel: Dolly /
/* Multi-Touch Rotate: Rotate /
/* Multi-Touch Pinch: Dolly /
/* Multi-Touch Pan: Pan /
/* 3D Events: Camera Pose */
I managed to switch the pan and zoom buttons without a problem.
But now I have a problem with the rotation centre. I did the below part to change the rotation to button 1.
`const Rotate = vtkMouseCameraTrackballRotateManipulator.newInstance({ button: 1 },);`
const iStyle = vtkInteractorStyleManipulator.newInstance();
iStyle.addMouseManipulator(Rotate);
and it worked but its rotation stuck to the origin, now my question is how can I change it as before default one?
I followed this [vtk.js] trackball/default interaction style with pan/zoom on other mouse buttons - #13 by banesullivan but didn’t get succeed.
I am using openglRenderWindow.setContainer(container); as a render.
Any suggestion:
Just call iStyle.setCenterOfRotation(x, y, z)
.
Hello there,
Thanks for the reply.
I mean how can I make the rotation centre based on the data bcoz currently by default, its centre is set to the origin.
I solved it, instead of fullScreenRenderer.getRenderer(), I need to pass renderer.
function getCenterOfScene (renderer) {
const bounds = renderer.computeVisiblePropBounds();
const center = [0, 0, 0];
center[0] = (bounds[0] + bounds[1]) / 2.0;
center[1] = (bounds[2] + bounds[3]) / 2.0;
center[2] = (bounds[4] + bounds[5]) / 2.0;
return center;
}
const center = getCenterOfScene(renderer);
iStyle.setCenterOfRotation(center);