From d34036152b86d86d1dabe2d719d5abe1e6f205a5 Mon Sep 17 00:00:00 2001 From: Marcel Partap Date: Thu, 4 Jun 2009 22:28:52 +0000 Subject: [PATCH] Further pimpage of auto scrolling: make it quadratic! Better scales to HUGE file lists now. Thx peter for the hint ;) CCBUG: 194235 svn path=/trunk/KDE/kdebase/apps/; revision=977658 --- src/dolphinviewautoscroller.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/dolphinviewautoscroller.cpp b/src/dolphinviewautoscroller.cpp index c5d5e47d7..4e7af7f59 100644 --- a/src/dolphinviewautoscroller.cpp +++ b/src/dolphinviewautoscroller.cpp @@ -26,6 +26,7 @@ #include #include #include +#include DolphinViewAutoScroller::DolphinViewAutoScroller(QAbstractItemView* parent) : QObject(parent), @@ -161,17 +162,17 @@ int DolphinViewAutoScroller::calculateScrollIncrement(int cursorPos, int rangeSi int inc = 0; const int minSpeed = 4; - const int maxSpeed = 64; - const int speedLimiter = 4; - const int autoScrollBorder = 32; + const int maxSpeed = 768; + const int speedLimiter = 48; + const int autoScrollBorder = 64; if (cursorPos < autoScrollBorder) { - inc = -minSpeed + (cursorPos - autoScrollBorder) / speedLimiter; + inc = -minSpeed + fabs(cursorPos - autoScrollBorder) * (cursorPos - autoScrollBorder) / speedLimiter; if (inc < -maxSpeed) { inc = -maxSpeed; } } else if (cursorPos > rangeSize - autoScrollBorder) { - inc = minSpeed + (cursorPos - rangeSize + autoScrollBorder) / speedLimiter; + inc = minSpeed + fabs(cursorPos - rangeSize + autoScrollBorder) * (cursorPos - rangeSize + autoScrollBorder) / speedLimiter; if (inc > maxSpeed) { inc = maxSpeed; } -- 2.47.3