diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index bf2b6a1f7..635c9166c 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -1890,20 +1890,27 @@ void MediaView::keyPressEvent(QKeyEvent *e) { } void MediaView::wheelEvent(QWheelEvent *e) { - if (e->delta() < 0) { - if (e->modifiers().testFlag(Qt::ControlModifier)) { - zoomOut(); - } else { - if (e->source() == Qt::MouseEventNotSynthesized) { - moveToNext(-1); + constexpr auto step = static_cast(QWheelEvent::DefaultDeltasPerStep); + + _verticalWheelDelta += e->angleDelta().y(); + while (qAbs(_verticalWheelDelta) >= step) { + if (_verticalWheelDelta < 0) { + _verticalWheelDelta += step; + if (e->modifiers().testFlag(Qt::ControlModifier)) { + zoomOut(); + } else { + if (e->source() == Qt::MouseEventNotSynthesized) { + moveToNext(1); + } } - } - } else { - if (e->modifiers().testFlag(Qt::ControlModifier)) { - zoomIn(); } else { - if (e->source() == Qt::MouseEventNotSynthesized) { - moveToNext(1); + _verticalWheelDelta -= step; + if (e->modifiers().testFlag(Qt::ControlModifier)) { + zoomIn(); + } else { + if (e->source() == Qt::MouseEventNotSynthesized) { + moveToNext(-1); + } } } } diff --git a/Telegram/SourceFiles/mediaview.h b/Telegram/SourceFiles/mediaview.h index 3f8756b39..ff1e85b6a 100644 --- a/Telegram/SourceFiles/mediaview.h +++ b/Telegram/SourceFiles/mediaview.h @@ -322,6 +322,8 @@ private: typedef QMap ShowingOpacities; ShowingOpacities _animOpacities; + int _verticalWheelDelta = 0; + void updateOverRect(OverState state); bool updateOverState(OverState newState); float64 overLevel(OverState control) const;