diff --git a/src/bin/bin.h b/src/bin/bin.h --- a/src/bin/bin.h +++ b/src/bin/bin.h @@ -441,6 +441,7 @@ void showTitleWidget(const std::shared_ptr &clip); void showSlideshowWidget(const std::shared_ptr &clip); void processAudioThumbs(); + int wheelAccumulatedDelta; signals: void itemUpdated(std::shared_ptr); diff --git a/src/bin/bin.cpp b/src/bin/bin.cpp --- a/src/bin/bin.cpp +++ b/src/bin/bin.cpp @@ -762,6 +762,7 @@ m_infoMessage->hide(); connect(this, &Bin::requesteInvalidRemoval, this, &Bin::slotQueryRemoval); connect(this, SIGNAL(displayBinMessage(QString, KMessageWidget::MessageType)), this, SLOT(doDisplayMessage(QString, KMessageWidget::MessageType))); + wheelAccumulatedDelta = 0; } Bin::~Bin() @@ -837,7 +838,10 @@ if (event->type() == QEvent::Wheel) { auto *e = static_cast(event); if ((e != nullptr) && e->modifiers() == Qt::ControlModifier) { - slotZoomView(e->delta() > 0); + wheelAccumulatedDelta += e->delta(); + if (abs(wheelAccumulatedDelta) >= QWheelEvent::DefaultDeltasPerStep) { + slotZoomView(wheelAccumulatedDelta > 0); + } // emit zoomView(e->delta() > 0); return true; } @@ -881,6 +885,7 @@ void Bin::slotZoomView(bool zoomIn) { + wheelAccumulatedDelta = 0; if (m_itemModel->rowCount() == 0) { // Don't zoom on empty bin return; diff --git a/src/timeline2/view/qml/timeline.qml b/src/timeline2/view/qml/timeline.qml --- a/src/timeline2/view/qml/timeline.qml +++ b/src/timeline2/view/qml/timeline.qml @@ -74,11 +74,14 @@ timeline.triggerAction('monitor_seek_snap_forward') } } else if (wheel.modifiers & Qt.ControlModifier) { + root.wheelAccumulatedDelta += wheel.angleDelta.y; // Zoom - if (wheel.angleDelta.y > 0) { + if (root.wheelAccumulatedDelta >= defaultDeltasPerStep) { root.zoomIn(true); - } else { + root.wheelAccumulatedDelta = 0; + } else if (root.wheelAccumulatedDelta <= -defaultDeltasPerStep) { root.zoomOut(true); + root.wheelAccumulatedDelta = 0; } } else if (wheel.modifiers & Qt.ShiftModifier) { // Vertical scroll @@ -231,6 +234,8 @@ property int copiedClip: -1 property int zoomOnMouse: -1 property int viewActiveTrack: timeline.activeTrack + property int wheelAccumulatedDelta: 0 + readonly property int defaultDeltasPerStep: 120 //onCurrentTrackChanged: timeline.selection = [] onTimeScaleChanged: {