[vtkusers] Change default mouse buttons

David Doria daviddoria at gmail.com
Wed May 22 07:57:49 EDT 2013


On Wed, May 22, 2013 at 5:27 AM, max perlman <smapersmaper at gmail.com> wrote:
> Dear VTKers,
> How do i change the mouse default buttons for rotation, dolly, zoom?
> I want to preserve the default behavior but for different mouse buttons.
> I tried to call the dolly() and rotate() functions but it does nothing...
>
> Max


You need to subclass an InteractorStyle

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/MouseEvents

and reimplement the functions like OnRightButtonDown(), etc. to call
the ones that you want to switch the behavior. For example:

    virtual void OnRightButtonDown()
    {
      vtkInteractorStyleTrackballCamera::OnLeftButtonDown();
    }

to make the behavior that normally happens when you click the left
button now happen when you click the right button. (Make sure you also
switch the *Up() functions as well, or you will get unexpected
behavior).

Good luck,

David



More information about the vtkusers mailing list