# How to disable right click zoom function individually?

**URL:** <https://discourse.slicer.org/t/how-to-disable-right-click-zoom-function-individually/18029>\
**Category:** Support\
**Created:** [June 9, 2021, 5:26am UTC](https://discourse.slicer.org/t/how-to-disable-right-click-zoom-function-individually/18029 "2021-06-09T05:26:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luxiaoyang9999](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/luxiaoyang9999/32/9026_2.png) [@luxiaoyang9999](https://discourse.slicer.org/u/luxiaoyang9999)\
**Post date:** [June 9, 2021, 5:26am UTC](https://discourse.slicer.org/t/how-to-disable-right-click-zoom-function-individually/18029/1 "2021-06-09T05:26:41Z")

</div>

Hello everyone  
I tried to disable right click zoom function through

```auto
interactorStyle = slicer.app.layoutManager().sliceWidget('Red').sliceView().sliceViewInteractorStyle()
interactorStyle.SetActionEnabled(interactorStyle.Zoom, False)

```

but it can also lead to that I cannot observe mouse position change event in CrosshairNode

```auto
   self.mycrosshairNode = slicer.util.getNode('Crosshair')
   self.observationId_rightclick = self.mycrosshairNode.AddObserver(slicer.vtkMRMLCrosshairNode.CursorPositionModifiedEvent, self.mouse_move_event)

def mouse_move_event(self, observer, eventid):
    ras = [0, 0, 0]
    pos = self.interactor_red.GetEventPosition()
    self.mycrosshairNode.GetCursorPositionRAS(ras)
    print(ras)

```

Could you tell me how to only disable right click zoom function?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 9, 2021, 1:55pm UTC](https://discourse.slicer.org/t/how-to-disable-right-click-zoom-function-individually/18029/2 "2021-06-09T13:55:32Z")

</div>

Due to a small bug, you need to re-enable cursor position setting after you disable any action:

```auto
interactorStyle = slicer.app.layoutManager().sliceWidget('Red').sliceView().sliceViewInteractorStyle()
interactorStyle.SetActionEnabled(interactorStyle.Zoom, False)
interactorStyle.SetActionEnabled(interactorStyle.SetCursorPosition, True)

```

We’ll fix this soon in the Slicer Preview Release, se this re-enabling `SetCursorPosition` will no longer be necessary.

---

<div class="post-metadata">

**Author:** ![luxiaoyang9999](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/luxiaoyang9999/32/9026_2.png) [@luxiaoyang9999](https://discourse.slicer.org/u/luxiaoyang9999)\
**Post date:** [June 9, 2021, 2:37pm UTC](https://discourse.slicer.org/t/how-to-disable-right-click-zoom-function-individually/18029/3 "2021-06-09T14:37:58Z")

</div>

Thank you for your help, this code works.

---

<div class="post-metadata">

**Author:** ![ond12](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ond12/32/8706_2.png) [@ond12](https://discourse.slicer.org/u/ond12)\
**Post date:** [July 7, 2021, 1:34pm UTC](https://discourse.slicer.org/t/how-to-disable-right-click-zoom-function-individually/18029/4 "2021-07-07T13:34:37Z")

</div>

Hello, Thank you for this usefull post.

How can i do the same things but for the 3D view ?

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [July 7, 2021, 2:00pm UTC](https://discourse.slicer.org/t/how-to-disable-right-click-zoom-function-individually/18029/5 "2021-07-07T14:00:56Z")

</div>

I believe like this:

`interactorStyle = slicer.app.layoutManager().threeDWidget(0).threeDView().interactorStyle()`
