# How to put a limit to zoom in?

**URL:** https://discourse.vtk.org/t/how-to-put-a-limit-to-zoom-in/9819
**Category:** Support
**Created:** [November 15, 2022, 6:32am UTC](https://discourse.vtk.org/t/how-to-put-a-limit-to-zoom-in/9819 "2022-11-15T06:32:20Z")
**Posts on this page:** 1
**Showing post:** 2

<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 26, 2022, 9:46pm UTC](https://discourse.vtk.org/t/how-to-put-a-limit-to-zoom-in/9819/2 "2022-11-26T21:46:12Z")

</div>

Hello,

One way to do it is to extend/customize the `vtkInteractorStyleTrackballCamera` classe like this one here: [gammaray/v3dmouseinteractor.h at master · PauloCarvalhoRJ/gammaray · GitHub](https://github.com/PauloCarvalhoRJ/gammaray/blob/master/viewer3d/v3dmouseinteractor.h). That 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`.

---

_[View the full topic](https://discourse.vtk.org/t/how-to-put-a-limit-to-zoom-in/9819)._
