banshee r4960 - in trunk/banshee: . src/Libraries/Hyena.Gui/Hyena.Widgets



Author: gburt
Date: Mon Jan 26 01:52:05 2009
New Revision: 4960
URL: http://svn.gnome.org/viewvc/banshee?rev=4960&view=rev

Log:
2009-01-25  Gabriel Burt  <gabriel burt gmail com>

	* src/Libraries/Hyena.Gui/Hyena.Widgets/SmoothScrolledWindow.cs: Improve
	the smooth scrolling by stopping in a nearly constant amount of
	time, and avoiding several small (1px) movements at the end of slowing
	down by making the minimum velocity 2px per cycle

Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/SmoothScrolledWindow.cs

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/SmoothScrolledWindow.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/SmoothScrolledWindow.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/SmoothScrolledWindow.cs	Mon Jan 26 01:52:05 2009
@@ -54,7 +54,7 @@
         
         protected virtual double DecelerateCore (double velocity)
         {
-            return velocity - 3;
+            return velocity - Math.Max (3, 0.2 * velocity);
         }
         
         private double TargetValue {
@@ -71,6 +71,7 @@
             }
         }
         
+        // Smoothly get us to the target value
         private bool OnTimeout ()
         {
             double delta = target_value - value;
@@ -91,9 +92,9 @@
             }
             
             velocity = hypothetical <= 0 ? Decelerate (velocity) : Accelerate (velocity);
-            
-            // Speed limit: 1 px / 20 ms = 50px / second
-            value = Math.Round (value + Math.Max (velocity, 1) * sign);
+
+            // Minimum speed: 2 px / 20 ms = 100px / second
+            value = Math.Round (value + Math.Max (velocity, 2) * sign);
 
             // Don't go past the target value
             value = (sign == 1) ? Math.Min (value, target_value) : Math.Max (value, target_value);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]