I want to associate a mousemove event handler to an interactor. this is done in python as
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
renderWindowInteractor.AddObserver("MouseMoveEvent", mousemove)
The problem is that this function doesn’t exist in vtk.js. Is there any way to achieve this?
I am currently using the container of the interactor container.addEventListener('mousemove', mousemove);
. But this creates some conflict with current mousemove events (when some manipulator is activated).
Is there a right way of doing this?
My mousemove function is
performanceTimer=performance.now();
function mousemove(event){
// If any interactor is active or mouse moves too fast do nothing
if ((performance.now()-performanceTimer<10) || interactor.getInteractorStyle().currentManipulator){
return;
} else {
// Do stuff
performanceTimer=performance.now();
}
}
vtkRenderWindowInterator trigger the following set of events.
So you should be able to do the following
const subscription = renderWindowInteractor.onMouseMove(mousemove);
Hello and thanks
Main question:
Does this onMouseMove come with a throttler, or do I have to make my own hack?
The main problem I have now is that my throttler messes up with the interactor event and the interaction happens only every number of ms (if I decrease them then the system halts with many calls to mousemove, if I increase it all the interactors became laggy)
I need to display the scalar contained int the cell under the mouse, but if any interactor is activated, then don’t trigger this mouse move function.
You can throttle the mousemove callback by decorating it.
I have solved the interaction conflict by changing this interactor.getInteractorStyle().currentManipulator
into event.button>=0
. Everything is working as intended now.
Somehow the current manipulator way is not working