Interactive Zoom Mouse Drag Direction

Currently, when you interactively zoom with the mouse, dragging the mouse up zooms out, and dragging down zooms in. I’m using my slicer module as an extension to a main app that zooms in the opposite direction. This confuses the users making them zoom in the wrong direction when in the slicer module UI.

Is there a way to make mouse drag up zoom in and mouse drag down zoom out?


Reviewing the current state of your SlicerQReads custom app, it appears you are using a modified Slicer version that has already swapped some zoom/pan functionality for mouse clicks by way of this commit. For inverting zoom in/out based on those mouse interactions I would suggest to look in those same files as that commit to then invert some more logic.

Hi @jamesobutler,

Here’s how I attempted to reverse the zoom mouse drag direction…

  1. Changed the following code in vtkMRMLSliceIntersectionWidget.cxx (MouseWheelForward = Zoom In / MouseWheelBackward = Zoom out) …
    this->SetEventTranslation(WidgetStateIdle, vtkCommand::MouseWheelForwardEvent, vtkEvent::ControlModifier, WidgetEventZoomInSlice); // DVP swapped Zoom In and Zoom Out
    this->SetEventTranslation(WidgetStateIdle, vtkCommand::MouseWheelBackwardEvent, vtkEvent::ControlModifier, WidgetEventZoomOutSlice); // DVP swapped Zoom In and Zoom Out

… And these lines in the PyObject *PyvtkMRMLSliceIntersectionWidget_ClassNew() method in vtkMRMLSliceIntersectionWidgetPython.cxx

    { "WidgetEventZoomInSlice", vtkMRMLSliceIntersectionWidget::WidgetEventZoomOutSlice },
    { "WidgetEventZoomOutSlice", vtkMRMLSliceIntersectionWidget::WidgetEventZoomInSlice },
  1. Does this look correct?
  2. Will this require a full rebuild?