diff --git a/src/GUI/graphview.cpp b/src/GUI/graphview.cpp index d6bd954a..652689b4 100644 --- a/src/GUI/graphview.cpp +++ b/src/GUI/graphview.cpp @@ -350,12 +350,12 @@ void GraphView::mousePressEvent(QMouseEvent *e) void GraphView::wheelEvent(QWheelEvent *e) { - static int deg = 0; + static int deg8 = 0; - deg += e->angleDelta().y() / 8; - if (qAbs(deg) < 15) + deg8 += e->angleDelta().y(); + if (qAbs(deg8) < (15 * 8)) return; - deg = 0; + deg8 = deg8 % (15 * 8); #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) QPointF pos = mapToScene(e->pos()); diff --git a/src/GUI/mapview.cpp b/src/GUI/mapview.cpp index 4e7edfe5..59fb57a0 100644 --- a/src/GUI/mapview.cpp +++ b/src/GUI/mapview.cpp @@ -586,17 +586,17 @@ void MapView::zoom(int zoom, const QPoint &pos, bool shift) void MapView::wheelEvent(QWheelEvent *event) { - static int deg = 0; + static int deg8 = 0; bool shift = (event->modifiers() & MODIFIER) ? true : false; // Shift inverts the wheel axis on OS X, so use scrolling in both axes for // the zoom. int delta = event->angleDelta().y() ? event->angleDelta().y() : event->angleDelta().x(); - deg += delta / 8; - if (qAbs(deg) < 15) + deg8 += delta; + if (qAbs(deg8) < (15 * 8)) return; - deg = 0; + deg8 = deg8 % (15 * 8); #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) zoom((delta > 0) ? 1 : -1, event->pos(), shift);