[vtk-developers] Mouse wheel support in VTK

Sebastien BARRE sebastien.barre at kitware.com
Wed Jan 28 16:49:52 EST 2004


At 1/28/2004 09:58 AM, Mathieu Malaterre wrote:
>Commit has been done.

I added a quick (and I hope not too dirty) support for mouse wheel in the 
default camera interactor styles. "Wheel forward" will zoom in, "backward" 
will zoom out.

in vtkInteractorStyle, I added:
   virtual void OnMouseWheelForward() {};
   virtual void OnMouseWheelBackward() {};

as well as a MouseWheelMotionFactor so that some control can be achieved on 
what a "mouse wheel motion step" represents (i.e, it's a multiplier, you 
can change it to specify how much of a change a wheel motion step represents).

In vtkInteractorStyleJoystickCamera and vtkInteractorStyleTrackballCamera, 
those 2 functions are overriden to perform zoom in/zoom out. The same thing 
could be done for the other interactor styles.

On the 3D widgets side (which inherit from vtkInteractorObserver, not 
vtkInteractorStyle), you can just update your ProcessEvents() to listen for 
MouseWheelForwardEvent, and MouseWheelBackwardEvent, and act accordingly.


--
Sebastien Barre





More information about the vtk-developers mailing list