[gnome-shell/wip/gdm-shell: 4/8] StAdjustment: fix elastic property



commit 1f30f8e74a6f859046aec9ef035e4219b061191c
Author: Ray Strode <rstrode redhat com>
Date:   Sat Jul 9 00:02:38 2011 -0400

    StAdjustment: fix elastic property
    
    StAdjustment has an elastic property that doesn't seem to do anything.
    
    This commit makes it do what it looks like the code originally intended
    it to do. Namely, make the interpolation animation springy.

 src/st/st-adjustment.c |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)
---
diff --git a/src/st/st-adjustment.c b/src/st/st-adjustment.c
index 57f0d69..69312c5 100644
--- a/src/st/st-adjustment.c
+++ b/src/st/st-adjustment.c
@@ -654,23 +654,18 @@ interpolation_new_frame_cb (ClutterTimeline *timeline,
                             StAdjustment    *adjustment)
 {
   StAdjustmentPrivate *priv = adjustment->priv;
+  gdouble progress = clutter_alpha_get_alpha (priv->bounce_alpha);
+  gdouble dx = priv->old_position
+               + (priv->new_position - priv->old_position)
+               * progress;
 
   priv->interpolation = NULL;
 
-  if (priv->elastic)
-    {
-      gdouble progress = clutter_alpha_get_alpha (priv->bounce_alpha) / 1.0;
-      gdouble dx = priv->old_position
-                   + (priv->new_position - priv->old_position)
-                   * progress;
+  if (!priv->elastic)
+    dx = CLAMP (dx, priv->lower,
+                MAX (priv->lower, priv->upper - priv->page_size));
 
-      st_adjustment_set_value (adjustment, dx);
-    }
-  else
-    st_adjustment_set_value (adjustment,
-                             priv->old_position +
-                             (priv->new_position - priv->old_position) *
-                             clutter_timeline_get_progress (timeline));
+  st_adjustment_set_value (adjustment, dx);
 
   priv->interpolation = timeline;
 }
@@ -729,6 +724,9 @@ st_adjustment_interpolate (StAdjustment *adjustment,
 
   if (priv->elastic)
     priv->bounce_alpha = clutter_alpha_new_full (priv->interpolation,
+                                                 CLUTTER_EASE_OUT_ELASTIC);
+  else
+    priv->bounce_alpha = clutter_alpha_new_full (priv->interpolation,
                                                  CLUTTER_LINEAR);
 
   g_signal_connect (priv->interpolation,



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