raster pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=ddeb728e0fd5dd47b85680d5f6fc693250bedec1

commit ddeb728e0fd5dd47b85680d5f6fc693250bedec1
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Mon Sep 14 14:45:19 2015 +0900

    elm scroller - improve thumbscroll smoothness even more
    
    this does even more smoothing of scrolling follow on from
    939d8ef4c3c48120046560814db63858175a2d12
---
 src/lib/elm_interface_scrollable.c | 54 ++++++++++++++++++++++++--------------
 1 file changed, 34 insertions(+), 20 deletions(-)

diff --git a/src/lib/elm_interface_scrollable.c 
b/src/lib/elm_interface_scrollable.c
index fa24d67..23d0ebb 100644
--- a/src/lib/elm_interface_scrollable.c
+++ b/src/lib/elm_interface_scrollable.c
@@ -2959,54 +2959,56 @@ _elm_scroll_hold_enterer(void *data)
 {
    Elm_Scrollable_Smart_Interface_Data *sid = data;
    Evas_Coord ox = 0, oy = 0, fx = 0, fy = 0;
+//   Evas_Coord fy2;
 
    sid->down.hold_enterer = NULL;
 
    fx = sid->down.hold_x;
    fy = sid->down.hold_y;
-//   printf("%1.5f %i ",
-//          ecore_loop_time_get() - sid->down.dragged_began_timestamp,
-//          fy);
-
+//   fy2 = fy;
    if ((_elm_config->scroll_smooth_amount > 0.0) &&
        (_elm_config->scroll_smooth_time_window > 0.0))
      {
         int i, count = 0;
         Evas_Coord basex = 0, basey = 0, x, y;
-        double dt, t, tdiff, tnow, twin;
+        double dt, tdiff, tnow, twin, ttot;
         double xx, yy, tot;
         struct
           {
-             Evas_Coord x, y, dx, dy;
-             double t, dt;
-          } pos[60];
+             Evas_Coord x, y;
+             double t;
+          } pos[100];
 
         tdiff = sid->down.hist.est_timestamp_diff;
         tnow = ecore_loop_time_get();
-        t = tnow;
         twin = _elm_config->scroll_smooth_time_window;
         for (i = 0; i < 60; i++)
           {
              if ((sid->down.history[i].timestamp - tdiff) > tnow)
-               {
-                  continue;
-               }
+               continue;
              if ((sid->down.history[i].timestamp >
                  sid->down.dragged_began_timestamp) || (count == 0))
                {
                   x = sid->down.history[i].x;
                   y = sid->down.history[i].y;
-                  if (i == 0)
+                  _elm_scroll_down_coord_eval(sid, &x, &y);
+                  if (count == 0)
                     {
                        basex = x;
                        basey = y;
                     }
-                  dt = t - sid->down.history[i].timestamp;
+                  dt = (tnow + tdiff) - sid->down.history[i].timestamp;
                   if ((dt > twin) && (count > 0)) break;
-                  _elm_scroll_down_coord_eval(sid, &x, &y);
-                  pos[i].x = x - basex;
-                  pos[i].y = y - basey;
-                  pos[i].t = sid->down.history[0].timestamp - 
sid->down.history[i].timestamp;
+                  if ((dt > 0.0) && (count == 0))
+                    {
+                       pos[count].x = x - basex;
+                       pos[count].y = y - basey;
+                       pos[count].t = 0.0;
+                       count++;
+                    }
+                  pos[count].x = x - basex;
+                  pos[count].y = y - basey;
+                  pos[count].t = dt;
                   count++;
                }
           }
@@ -3015,9 +3017,19 @@ _elm_scroll_hold_enterer(void *data)
              xx = 0.0;
              yy = 0.0;
              tot = 0.0;
+             ttot = pos[count - 1].t;
              for (i = 0; i < count; i++)
                {
-                  double wt = (twin - pos[i].t) / twin;
+                  double wt;
+
+                  if (ttot > 0.0)
+                    {
+                       if (i < (count - 1))
+                         wt = (ttot - pos[i].t) * (pos[i + 1].t - pos[i].t);
+                       else
+                         wt = 0.0;
+                    }
+                  else wt = 1.0;
 
                   xx += ((double)(pos[i].x)) * wt;
                   yy += ((double)(pos[i].y)) * wt;
@@ -3036,7 +3048,9 @@ _elm_scroll_hold_enterer(void *data)
                }
           }
      }
-//   printf("%i\n", fy);
+//   printf("%1.5f %i %i\n",
+//          ecore_loop_time_get() - sid->down.dragged_began_timestamp,
+//          fy, fy2);
 
    eo_do(sid->obj, elm_interface_scrollable_content_pos_get(&ox, &oy));
    if (sid->down.dir_x)

-- 


Reply via email to