From ffd5cd208c277b148d0e3a85d49330149f02f0c8 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Sat, 15 Dec 2012 19:16:32 -0600 Subject: [PATCH] Viewport: Only zoom in/out at vertical wheel events 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 --- pv/view/viewport.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pv/view/viewport.cpp b/pv/view/viewport.cpp index 6ce52abc..2b03b767 100644 --- a/pv/view/viewport.cpp +++ b/pv/view/viewport.cpp @@ -115,7 +115,11 @@ void Viewport::mouseReleaseEvent(QMouseEvent *event) 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) -- 2.30.2