]> sigrok.org Git - pulseview.git/commitdiff
viewport: Allow smoother zoom using vertical scroll events
authorSylvain Munaut <redacted>
Sun, 28 May 2017 14:53:27 +0000 (16:53 +0200)
committerUwe Hermann <redacted>
Sun, 28 May 2017 15:54:02 +0000 (17:54 +0200)
The zoom supports 'double' as input type but since delta() and 120 are
integer, this wasn't used and any event with a delta lower than 120 was
ignored.

With this mod, the zoom level changes are _much_ smoother on trackpads

Signed-off-by: Sylvain Munaut <redacted>
pv/view/viewport.cpp

index a179cef1c6ca572609e12ad10ad3ad2de2eef59e..70282d290f8efef39ed4859e00234c829a9710ee 100644 (file)
@@ -210,7 +210,7 @@ void Viewport::wheelEvent(QWheelEvent *event)
                                (event->delta() * height()) / (8 * 120));
                } else {
                        // Vertical scrolling is interpreted as zooming in/out
-                       view_.zoom(event->delta() / 120, event->x());
+                       view_.zoom(event->delta() / 120.0, event->x());
                }
        } else if (event->orientation() == Qt::Horizontal) {
                // Horizontal scrolling is interpreted as moving left/right