# Add custom interaction with sliceview

**URL:** <https://discourse.slicer.org/t/add-custom-interaction-with-sliceview/34061>\
**Category:** Development\
**Created:** [January 31, 2024, 10:42am UTC](https://discourse.slicer.org/t/add-custom-interaction-with-sliceview/34061 "2024-01-31T10:42:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [January 31, 2024, 10:42am UTC](https://discourse.slicer.org/t/add-custom-interaction-with-sliceview/34061/1 "2024-01-31T10:42:02Z")

</div>

Hi,

There are two ways to zoom slice view:

1. hold right mouse btn adn drag
2. hold `ctrl` key and use wheel

I’m going to implement the interaction that changes FOV independently by vertical and horizontal dimensions when user holds `ctrl` and drag mouse with right button mouse pressed.

Is there a way to do that inside custom displayable manager or do I have to modify `vtkMRMLSliceViewInteractorStyle`?

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [February 1, 2024, 4:20pm UTC](https://discourse.slicer.org/t/add-custom-interaction-with-sliceview/34061/2 "2024-02-01T16:20:21Z")

</div>

This can be done with custom displayable manager’s methods:

```auto
public:
  virtual bool CanProcessInteractionEvent(vtkMRMLInteractionEventData* eventData, double &closestDistance2) override;
  virtual bool ProcessInteractionEvent(vtkMRMLInteractionEventData* eventData) override;

```

`eventData` contains all the necessary information about hotkeys and mouse pisition.

And sliceview zooming implementation example can be found in `vtkMRMLSliceIntersectionWidget::ProcessZoomSlice`
