How to disable right click Zoom function

Hello everyone,
I want to implement my right click function in slicer. however, when I use observer to active my right click function, the default zoom function will also be activated and it cannot be closed.
interactorStyle = slicer.app.layoutManager().sliceWidget(‘Red’).sliceView().sliceViewInteractorStyle()
interactorStyle.SetActionEnabled(interactorStyle.Zoom, False)
If I use above code to close zoom function, all relative functions will be closed, including ctrl+ mouse scrolling zoom function, this is function I need. Could anyone tell my how to only close the right click zoom function in slicer.

You can fully reprogram all mouse and keyboard shortcuts in all the views, any way you want, just by using Python scripting. See examples in the script repository.

Adding a VTK event observer is generally not the right way to implement custom mouse&keyboard shortcuts (it would be too low level, so it would interfere with Slicer’s event routing). What would you like to achieve? Display a context menu if the user clicks in a view?

I would like to create a right-click menu in a view. Moreover, when I use
interactorStyle.SetActionEnabled(interactorStyle.Zoom, False)
, I cannot get mouse position in view through crosshairNode like this

    event2 = slicer.vtkMRMLCrosshairNode.CursorPositionModifiedEvent
    crosshairNode = slicer.util.getNode("Crosshair")
    obs2 = crosshairNode.AddObserver(event2, self.updateAnnotation_One_call)

FYI, we’ll enable right-click menu in views about 2 weeks. You’ll be able to register your own menu items via subject hierarchy (the same way as all other menu items are registered in the Subject hierarchy tree, in Data module).