summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-08-26 20:48:06 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-08-26 20:48:06 +0200
commitbdf6bc2e9788c9fd780b314bd886ec51765cabc8 (patch)
tree0fee8c8e6abb1d43d712fe2e9f673e6d9c9a353c /src
parentMerge branch 'm2_191' (diff)
parentFinally fix the smooth scrolling distance per scroll (diff)
downloadrekonq-bdf6bc2e9788c9fd780b314bd886ec51765cabc8.tar.xz
Merge commit 'refs/merge-requests/2292' of git://gitorious.org/rekonq/mainline
Diffstat (limited to 'src')
-rw-r--r--src/webview.cpp15
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));
}
}