]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Further pimpage of auto scrolling: make it quadratic! Better scales to HUGE file...
authorMarcel Partap <mpartap@gmx.net>
Thu, 4 Jun 2009 22:28:52 +0000 (22:28 +0000)
committerMarcel Partap <mpartap@gmx.net>
Thu, 4 Jun 2009 22:28:52 +0000 (22:28 +0000)
CCBUG: 194235

svn path=/trunk/KDE/kdebase/apps/; revision=977658

src/dolphinviewautoscroller.cpp

index c5d5e47d7224d7340da27cc7fc558cba153b21ff..4e7af7f59fa9ad77f9fdd2b858d74a9115446069 100644 (file)
@@ -26,6 +26,7 @@
 #include <QMouseEvent>
 #include <QScrollBar>
 #include <QTimer>
 #include <QMouseEvent>
 #include <QScrollBar>
 #include <QTimer>
+#include <math.h>
 
 DolphinViewAutoScroller::DolphinViewAutoScroller(QAbstractItemView* parent) :
     QObject(parent),
 
 DolphinViewAutoScroller::DolphinViewAutoScroller(QAbstractItemView* parent) :
     QObject(parent),
@@ -161,17 +162,17 @@ int DolphinViewAutoScroller::calculateScrollIncrement(int cursorPos, int rangeSi
     int inc = 0;
 
     const int minSpeed = 4;
     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) {
 
     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) {
         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;
         }
         if (inc > maxSpeed) {
             inc = maxSpeed;
         }