# Change response of render window to interactions

**URL:** https://discourse.vtk.org/t/change-response-of-render-window-to-interactions/9733
**Category:** Support
**Created:** [November 3, 2022, 11:45am UTC](https://discourse.vtk.org/t/change-response-of-render-window-to-interactions/9733 "2022-11-03T11:45:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Manju](https://discourse.vtk.org/user_avatar/discourse.vtk.org/manju/32/7440_2.png) [@Manju](https://discourse.vtk.org/u/Manju)
#### Post date: [November 3, 2022, 11:45am UTC](https://discourse.vtk.org/t/change-response-of-render-window-to-interactions/9733/1 "2022-11-03T11:45:16Z")

</div>

I am using a Qvtkwidget to display images in an application. Image interactions are enabled via render window interactor. vtkinteractorstyle image is used. Clicking and dragging on the image results in window and level change. However the scale of this change is drastic. Is there any way to reduce the range of this change? Or rather change the response of click and drag to say, panning the image.

Pressing down shift button + click and drag OR  
Mouse wheel down and drag, results in panning the image.  
Could it be manipulated so that simple click and drag pans the image.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 6, 2022, 12:36pm UTC](https://discourse.vtk.org/t/change-response-of-render-window-to-interactions/9733/2 "2022-11-06T12:36:19Z")

</div>

Hello,

One way to do it is to extend/customize one of the `vtkInteractorStyle*` classes like this one here: [gammaray/v3dmouseinteractor.h at master · PauloCarvalhoRJ/gammaray · GitHub](https://github.com/PauloCarvalhoRJ/gammaray/blob/master/viewer3d/v3dmouseinteractor.h). This one is a modified `vtkInteractorStyleTrackballCamera` to enable probing of mesh values via mouse picking with a probe marker. The probe marker is a small red sphere that must be resized according to the zoom applied so its angular size stays the same. To use a custom interactor style, do like this:

```cpp
    m_myInteractorStyle = vtkSmartPointer<myInteractorStyle>::New();
    m_myInteractorStyle->SetDefaultRenderer( m_renderer );
    m_vtkwidget->renderWindow()->GetInteractor()->SetInteractorStyle( m_myInteractorStyle );

```

In the example above, `m_vtkwidget` is a `QVTKOpenGLNativeWidget`.

---

<div class="post-metadata">

### Author: ![Manju](https://discourse.vtk.org/user_avatar/discourse.vtk.org/manju/32/7440_2.png) [@Manju](https://discourse.vtk.org/u/Manju)
#### Post date: [November 23, 2022, 8:38am UTC](https://discourse.vtk.org/t/change-response-of-render-window-to-interactions/9733/4 "2022-11-23T08:38:10Z")

</div>

I was able to implement a custom interactor class keeping the link you shared as reference. And could achieve the desired behavior. Thanks a ton!
