summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-09-14 14:45:19 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-09-14 14:45:19 +0900
commitddeb728e0fd5dd47b85680d5f6fc693250bedec1 (patch)
treefe952859c44e08ce9b145f78b09385b5daeecad0
parent740cc0751807bb0c0bbb393d6e0d2e1588eb0678 (diff)
elm scroller - improve thumbscroll smoothness even more
this does even more smoothing of scrolling follow on from 939d8ef4c3c48120046560814db63858175a2d12
-rw-r--r--src/lib/elm_interface_scrollable.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/src/lib/elm_interface_scrollable.c b/src/lib/elm_interface_scrollable.c
index fa24d67ea..23d0ebba1 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)
2959{ 2959{
2960 Elm_Scrollable_Smart_Interface_Data *sid = data; 2960 Elm_Scrollable_Smart_Interface_Data *sid = data;
2961 Evas_Coord ox = 0, oy = 0, fx = 0, fy = 0; 2961 Evas_Coord ox = 0, oy = 0, fx = 0, fy = 0;
2962// Evas_Coord fy2;
2962 2963
2963 sid->down.hold_enterer = NULL; 2964 sid->down.hold_enterer = NULL;
2964 2965
2965 fx = sid->down.hold_x; 2966 fx = sid->down.hold_x;
2966 fy = sid->down.hold_y; 2967 fy = sid->down.hold_y;
2967// printf("%1.5f %i ", 2968// fy2 = fy;
2968// ecore_loop_time_get() - sid->down.dragged_began_timestamp,
2969// fy);
2970
2971 if ((_elm_config->scroll_smooth_amount > 0.0) && 2969 if ((_elm_config->scroll_smooth_amount > 0.0) &&
2972 (_elm_config->scroll_smooth_time_window > 0.0)) 2970 (_elm_config->scroll_smooth_time_window > 0.0))
2973 { 2971 {
2974 int i, count = 0; 2972 int i, count = 0;
2975 Evas_Coord basex = 0, basey = 0, x, y; 2973 Evas_Coord basex = 0, basey = 0, x, y;
2976 double dt, t, tdiff, tnow, twin; 2974 double dt, tdiff, tnow, twin, ttot;
2977 double xx, yy, tot; 2975 double xx, yy, tot;
2978 struct 2976 struct
2979 { 2977 {
2980 Evas_Coord x, y, dx, dy; 2978 Evas_Coord x, y;
2981 double t, dt; 2979 double t;
2982 } pos[60]; 2980 } pos[100];
2983 2981
2984 tdiff = sid->down.hist.est_timestamp_diff; 2982 tdiff = sid->down.hist.est_timestamp_diff;
2985 tnow = ecore_loop_time_get(); 2983 tnow = ecore_loop_time_get();
2986 t = tnow;
2987 twin = _elm_config->scroll_smooth_time_window; 2984 twin = _elm_config->scroll_smooth_time_window;
2988 for (i = 0; i < 60; i++) 2985 for (i = 0; i < 60; i++)
2989 { 2986 {
2990 if ((sid->down.history[i].timestamp - tdiff) > tnow) 2987 if ((sid->down.history[i].timestamp - tdiff) > tnow)
2991 { 2988 continue;
2992 continue;
2993 }
2994 if ((sid->down.history[i].timestamp > 2989 if ((sid->down.history[i].timestamp >
2995 sid->down.dragged_began_timestamp) || (count == 0)) 2990 sid->down.dragged_began_timestamp) || (count == 0))
2996 { 2991 {
2997 x = sid->down.history[i].x; 2992 x = sid->down.history[i].x;
2998 y = sid->down.history[i].y; 2993 y = sid->down.history[i].y;
2999 if (i == 0) 2994 _elm_scroll_down_coord_eval(sid, &x, &y);
2995 if (count == 0)
3000 { 2996 {
3001 basex = x; 2997 basex = x;
3002 basey = y; 2998 basey = y;
3003 } 2999 }
3004 dt = t - sid->down.history[i].timestamp; 3000 dt = (tnow + tdiff) - sid->down.history[i].timestamp;
3005 if ((dt > twin) && (count > 0)) break; 3001 if ((dt > twin) && (count > 0)) break;
3006 _elm_scroll_down_coord_eval(sid, &x, &y); 3002 if ((dt > 0.0) && (count == 0))
3007 pos[i].x = x - basex; 3003 {
3008 pos[i].y = y - basey; 3004 pos[count].x = x - basex;
3009 pos[i].t = sid->down.history[0].timestamp - sid->down.history[i].timestamp; 3005 pos[count].y = y - basey;
3006 pos[count].t = 0.0;
3007 count++;
3008 }
3009 pos[count].x = x - basex;
3010 pos[count].y = y - basey;
3011 pos[count].t = dt;
3010 count++; 3012 count++;
3011 } 3013 }
3012 } 3014 }
@@ -3015,9 +3017,19 @@ _elm_scroll_hold_enterer(void *data)
3015 xx = 0.0; 3017 xx = 0.0;
3016 yy = 0.0; 3018 yy = 0.0;
3017 tot = 0.0; 3019 tot = 0.0;
3020 ttot = pos[count - 1].t;
3018 for (i = 0; i < count; i++) 3021 for (i = 0; i < count; i++)
3019 { 3022 {
3020 double wt = (twin - pos[i].t) / twin; 3023 double wt;
3024
3025 if (ttot > 0.0)
3026 {
3027 if (i < (count - 1))
3028 wt = (ttot - pos[i].t) * (pos[i + 1].t - pos[i].t);
3029 else
3030 wt = 0.0;
3031 }
3032 else wt = 1.0;
3021 3033
3022 xx += ((double)(pos[i].x)) * wt; 3034 xx += ((double)(pos[i].x)) * wt;
3023 yy += ((double)(pos[i].y)) * wt; 3035 yy += ((double)(pos[i].y)) * wt;
@@ -3036,7 +3048,9 @@ _elm_scroll_hold_enterer(void *data)
3036 } 3048 }
3037 } 3049 }
3038 } 3050 }
3039// printf("%i\n", fy); 3051// printf("%1.5f %i %i\n",
3052// ecore_loop_time_get() - sid->down.dragged_began_timestamp,
3053// fy, fy2);
3040 3054
3041 eo_do(sid->obj, elm_interface_scrollable_content_pos_get(&ox, &oy)); 3055 eo_do(sid->obj, elm_interface_scrollable_content_pos_get(&ox, &oy));
3042 if (sid->down.dir_x) 3056 if (sid->down.dir_x)