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



Author: gburt
Date: Thu May  8 23:42:35 2008
New Revision: 3911
URL: http://svn.gnome.org/viewvc/banshee?rev=3911&view=rev

Log:
2008-05-08  Gabriel Burt  <gabriel burt gmail com>

	* src/Libraries/Hyena.Gui/Hyena.Widgets/SmoothScrolledWindow.cs: Increase
	both accel and decel, and fix bug where things would bounce back and
	forth, overshooting the target.


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	Thu May  8 23:42:35 2008
@@ -49,12 +49,12 @@
         
         protected virtual double AccelerateCore (double velocity)
         {
-            return velocity + 3;
+            return velocity + 8;
         }
         
         protected virtual double DecelerateCore (double velocity)
         {
-            return velocity - 2;
+            return velocity - 3;
         }
         
         private double TargetValue {
@@ -92,7 +92,12 @@
             
             velocity = hypothetical <= 0 ? Decelerate (velocity) : Accelerate (velocity);
             
-            value += Math.Max (velocity, 1) * sign;
+            // Speed limit: 1 px / 20 ms = 50px / second
+            value = Math.Round (value + Math.Max (velocity, 1) * sign);
+
+            // Don't go past the target value
+            value = (sign == 1) ? Math.Min (value, target_value) : Math.Max (value, target_value);
+
             ignore_value_changed = true;
             Vadjustment.Value = Math.Round (value);
             ignore_value_changed = false;



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