Viewport always zoomed the signals in and out on a wheel event. Moving the
scroll wheel up or down caused the intended effect of zooming in or zooming out,
respectively. This works flawlessly on mice with only a vertical wheel.
On mice with a horizontal or tilting wheel, horizontal scrolling or tilting was
still treated as zooming in and out. This created a non-intuitive experience,
as the user expects the signals to scroll left or right with this gesture.
Check to make sure the wheel event is a vertical one, and only then zoom in/out.
Do nothing if the wheel event is not vertical.
Signed-off-by: Alexandru Gagniuc <redacted>
void Viewport::wheelEvent(QWheelEvent *event)
{
assert(event);
- _view.zoom(event->delta() / 120, event->x());
+
+ if (event->orientation() == Qt::Vertical) {
+ // Vertical scrolling is interpreted as zooming in/out
+ _view.zoom(event->delta() / 120, event->x());
+ }
}
void Viewport::draw_cursors_background(QPainter &p)