callback set on vtkWidgetCallbackMapper - vtkCommand::MouseMoveEvent working randomely in vtk 9

Code snippet

================

->CallbackMapper->SetCallbackMethod(vtkCommand::MouseMoveEvent,
vtkWidgetEvent::Move,
this, vtkOrientationBoxMarkerWidget::MoveAction);

The callback was working perfectly in vtk 5 but not in vtk 9 - hitting occationally.

Any alternatives to invoke mouseMove/ or any other better way?

Hello,

Well, a modern way to implement what you want is to derive vtkInteractorStyleTrackballCamera.

Here’s an example: gammaray/viewer3d/v3dmouseinteractor.h at master · PauloCarvalhoRJ/gammaray · GitHub gammaray/viewer3d/v3dmouseinteractor.cpp at master · PauloCarvalhoRJ/gammaray · GitHub and an example of how to use it:

// Customize event handling through a subclass of vtkInteractorStyleTrackballCamera.
// This allows picking and probing by clicking on objects in the scene, for example.
m_myInteractor = vtkSmartPointer<v3dMouseInteractor>::New();
m_myInteractor->SetDefaultRenderer(m_renderer);
m_vtkwidget->renderWindow()->GetInteractor()->SetInteractorStyle( m_myInteractor );

I hope this helps you update your VTK 5 code.

best,

PC