diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-08-26 20:48:06 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-08-26 20:48:06 +0200 |
commit | bdf6bc2e9788c9fd780b314bd886ec51765cabc8 (patch) | |
tree | 0fee8c8e6abb1d43d712fe2e9f673e6d9c9a353c /src | |
parent | Merge branch 'm2_191' (diff) | |
parent | Finally fix the smooth scrolling distance per scroll (diff) | |
download | rekonq-bdf6bc2e9788c9fd780b314bd886ec51765cabc8.tar.xz |
Merge commit 'refs/merge-requests/2292' of git://gitorious.org/rekonq/mainline
Diffstat (limited to 'src')
-rw-r--r-- | src/webview.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/webview.cpp b/src/webview.cpp index 1ffb2f1e..d911bc3a 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -540,8 +540,9 @@ void WebView::keyPressEvent(QKeyEvent *event) void WebView::wheelEvent(QWheelEvent *event) { // To let some websites (eg: google maps) to handle wheel events - int ypos = page()->currentFrame()->scrollPosition().y(); + int prevPos = page()->currentFrame()->scrollPosition().y(); KWebView::wheelEvent(event); + int newPos = page()->currentFrame()->scrollPosition().y(); // Sync with the zoom slider if (event->modifiers() == Qt::ControlModifier) @@ -559,23 +560,21 @@ void WebView::wheelEvent(QWheelEvent *event) emit zoomChanged(newFactor); } - else if (ReKonfig::smoothScrolling() && ypos != page()->currentFrame()->scrollPosition().y()) + else if (ReKonfig::smoothScrolling() && prevPos != newPos) { - page()->currentFrame()->setScrollPosition(QPoint(page()->currentFrame()->scrollPosition().x(), ypos)); - int numDegrees = event->delta() / 8; - int numSteps = numDegrees / 15; + page()->currentFrame()->setScrollPosition(QPoint(page()->currentFrame()->scrollPosition().x(), prevPos)); - if ((numSteps > 0) != !_scrollBottom) + if ((event->delta() > 0) != !_scrollBottom) stopScrolling(); - if (numSteps > 0) + if (event->delta() > 0) _scrollBottom = false; else _scrollBottom = true; - setupSmoothScrolling(QApplication::wheelScrollLines() * abs(numSteps) * 20); + setupSmoothScrolling(abs(newPos - prevPos)); } } |