2008-05-20 Alejandro G. Castro <alex@igalia.com>
authorAlejandro G. Castro <alex@igalia.com>
Tue, 20 May 2008 12:32:03 +0000 (12:32 +0000)
committerAlejandro G. Castro <alex@igalia.com>
Tue, 20 May 2008 12:32:03 +0000 (12:32 +0000)
Bouncing effect added when touching the borders, you can change
the elasticity of the border changing the ELASTICITY define.

* src/hildon-pannable-area.c: Added ELASTICITY define.
(hildon_pannable_area_timeout): Added inverse velocity when
touching the border of the child widget, that causes a bounce.

ChangeLog
src/hildon-pannable-area.c

index faefcc9..538bc22 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2008-05-20 Alejandro G. Castro <alex@igalia.com>
 
+       Bouncing effect added when touching the borders, you can change
+       the elasticity of the border changing the ELASTICITY define.
+       
+       * src/hildon-pannable-area.c: Added ELASTICITY define.
+       (hildon_pannable_area_timeout): Added inverse velocity when
+       touching the border of the child widget, that causes a bounce.
+
+2008-05-20 Alejandro G. Castro <alex@igalia.com>
+
        Improved performance, we now do not go to the X server in order to
        get the list of window children. Apparently the effect is the
        same, we have to be careful and check if this breaks something in
index 9e43078..e48df7b 100644 (file)
@@ -41,6 +41,7 @@
 
 #define SMOOTH_FACTOR 0.85
 #define FORCE 5
+#define ELASTICITY 0.3
 
 #include <gdk/gdkx.h>
 #include "hildon-pannable-area.h"
@@ -421,9 +422,16 @@ hildon_pannable_area_timeout                    (HildonPannableArea *area)
      * initial scroll position to the new mouse co-ordinate. This means
      * when you get to the top of the page, dragging down works immediately.
      */
-    if (!sx) priv->x = priv->ex;
-    if (!sy) priv->y = priv->ey;
+    if (!sx) {
+        priv->x = priv->ex;
+        priv->vel_x *= -1 * priv->decel * ELASTICITY;
+    }
 
+    if (!sy) {
+        priv->y = priv->ey;
+        priv->vel_y *= -1 * priv->decel * ELASTICITY;
+    }
+    
     return TRUE;
 }