Hi CodeWarrior,
Thanks for feedbacking of the kinetic scrolling stuff. I personally like to watch them bouncing all around so I set the variables and
allow them changed very fast.  :-P
As you suggested I'd like to make this not bouncing too fast, and here is the patch.
:-)

 With this patch, the partial speed will calculated with last speed.
Also set the MAX_SPEED in case of a quick slide in a very short time period. That will make the scrolled view not bouncing so fast.


Cheers,
Tick
Index: etk/src/lib/etk_scrolled_view.c
===================================================================
--- etk.orig/src/lib/etk_scrolled_view.c	2008-04-29 14:08:18.000000000 +0800
+++ etk/src/lib/etk_scrolled_view.c	2008-04-29 15:09:22.000000000 +0800
@@ -716,6 +716,8 @@
       drag->mouse_down = ETK_TRUE;
       drag->timestamp = ecore_time_get(); 
       drag->old_timestamp = 0.0f;
+      drag->Vx=0;
+      drag->Vy=0;
       drag->position = event->widget;
       drag->bar_position.x = hscrollbar_range->value;
       drag->bar_position.y = vscrollbar_range->value;
@@ -767,8 +769,8 @@
       {
          drag->old_timestamp = drag->timestamp;
          drag->timestamp = ecore_time_get();
-         drag->Vx = (hscrollbar_range->value - drag->bar_position.x) / delta_time;
-         drag->Vy = (vscrollbar_range->value - drag->bar_position.y) / delta_time;
+         drag->Vx = (drag->Vx + (hscrollbar_range->value - drag->bar_position.x) / delta_time) / 2;
+         drag->Vy = (drag->Vy + (vscrollbar_range->value - drag->bar_position.y) / delta_time) / 2;
          drag->bar_position.x = hscrollbar_range->value;
          drag->bar_position.y = vscrollbar_range->value;
       }
@@ -803,6 +805,14 @@
    if (drag->scroll_flag) 
    {
       drag->timestamp = ecore_time_get();
+      int MAX_SPEED = ETK_SCROLLED_VIEW_DRAG_DAMPING_MAGIC*5;
+      drag->Vx = drag->Vx > 0 ?  
+         drag->Vx > MAX_SPEED ?  MAX_SPEED : drag->Vx : 
+         drag->Vx < -MAX_SPEED ? -MAX_SPEED : drag->Vx;
+      drag->Vy = drag->Vy > 0 ?  
+         drag->Vy > MAX_SPEED ?  MAX_SPEED : drag->Vy : 
+         drag->Vy < -MAX_SPEED ? -MAX_SPEED : drag->Vy;
+
       ecore_animator_add(&_etk_scrolled_view_motive_bounce, scrolled_view);
       return ETK_TRUE;
    }
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to