[gnome-shell/wip/gdm-shell: 6/16] StAdjustment: Fix elastic property to be elastic
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/gdm-shell: 6/16] StAdjustment: Fix elastic property to be elastic
- Date: Wed, 24 Aug 2011 15:10:30 +0000 (UTC)
commit 3cb98325b4d7276624c94245b276c832f327b3af
Author: Ray Strode <rstrode redhat com>
Date: Sat Jul 9 00:02:38 2011 -0400
StAdjustment: Fix elastic property to be elastic
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]