[Pychord-commits] r76 - trunk/pgui

danilo at garage.maemo.org danilo at garage.maemo.org
Fri Mar 28 18:18:59 EET 2008


Author: danilo
Date: 2008-03-28 18:18:58 +0200 (Fri, 28 Mar 2008)
New Revision: 76

Modified:
   trunk/pgui/list.py
Log:
- Smoothing lists movement

Modified: trunk/pgui/list.py
===================================================================
--- trunk/pgui/list.py	2008-03-28 15:50:55 UTC (rev 75)
+++ trunk/pgui/list.py	2008-03-28 16:18:58 UTC (rev 76)
@@ -62,6 +62,7 @@
         if self.totalSize < obj.size[1] + obj.rel_pos[1]:
             self.totalSize = obj.size[1] + obj.rel_pos[1]
        
+    
     def update(self):
         if self.clicked:
             pos = pygame.mouse.get_rel()
@@ -69,12 +70,13 @@
             
             
         elif self.autoScrollEnabled:
-            moveFactor = (1 + self.autoScrollSpeed/pguiListMaximumSpeed )
-            self.speedAux += moveFactor
-      
-            if self.speedAux > moveFactor*pguiListMaximumSpeed - self.autoScrollSpeed:
-                self.speedAux = 0
-                self.move(-moveFactor)  
+            
+            moveFactor = self.autoScrollSpeed/float(pguiListMaximumSpeed)
+            self.oldMoveFactor += moveFactor/float(pguiListMaximumSpeed)
+            
+            if self.oldMoveFactor > 1:
+                self.oldMoveFactor -= 1
+                self.move(-1)
                 
         container.update(self)
                 
@@ -105,9 +107,9 @@
 
         
         if speed <= 0:
-            self.speedAux = 0
             self.autoScrollEnabled = False
             self.autoScrollSpeed = 0
+            self.oldMoveFactor = float(0)
         else:
             self.autoScrollEnabled = True
             self.autoScrollSpeed = speed



More information about the Pychord-commits mailing list