Add the config elm_scroll_smooth_start_enable.
authorJaehwan Kim <jae.hwan.kim@samsung.com>
Tue, 30 Apr 2013 07:46:59 +0000 (16:46 +0900)
committerJaehwan Kim <jae.hwan.kim@samsung.com>
Tue, 30 Apr 2013 07:48:18 +0000 (16:48 +0900)
There's no tick when scroller starts scroll if it's set.

ChangeLog
NEWS
config/default/base.src
config/mobile/base.src
config/standard/base.src
src/lib/elm_config.c
src/lib/elm_interface_scrollable.c
src/lib/elm_interface_scrollable.h
src/lib/elm_priv.h

index ef59b77..fab69bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 2013-04-29  ChunEon Park (Hermet)
 
         * Fix toolbar item clipped problem on reordering toolbar item.
+
+2013-04-30  Jaehwan Kim
+
+        * Add the config elm_scroll_smooth_start_enable.
+        There's no tick when scroller starts scroll if it's set.
diff --git a/NEWS b/NEWS
index 76880ec..6a1c4b6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -64,6 +64,7 @@ Additions:
    * Add elm_access_action(), elm_access_action_cb_set()
    * Add elm_object_domain_part_text_translatable_set(), elm_object_item_domain_part_text_translatable_set().
    * Support language,changed callback (Fileselector_Button, Fileselector Entry, Spinner.
+   * Add the config elm_scroll_smooth_start_enable.
 
 Improvements:
 
index 8177b3c..3b396b6 100644 (file)
@@ -17,6 +17,7 @@ group "Elm_Config" struct {
   value "zoom_friction" double: 0.5;
   value "thumbscroll_border_friction" double: 0.5;
   value "thumbscroll_sensitivity_friction" double: 0.25;
+  value "scroll_smooth_start_enable" uchar: 0;
   value "scroll_smooth_time_interval" double: 0.0;
   value "scroll_smooth_amount" double: 0.0;
   value "scroll_smooth_history_weight" double: 0.1;
index 9037022..ea10161 100644 (file)
@@ -17,6 +17,7 @@ group "Elm_Config" struct {
   value "zoom_friction" double: 0.5;
   value "thumbscroll_border_friction" double: 0.5;
   value "thumbscroll_sensitivity_friction" double: 0.25;
+  value "scroll_smooth_start_enable" uchar: 1;
   value "scroll_smooth_time_interval" double: 0;
   value "scroll_smooth_amount" double: 1.0;
   value "scroll_smooth_history_weight" double: 0.1;
index 8bd1a18..65ea080 100644 (file)
@@ -17,6 +17,7 @@ group "Elm_Config" struct {
   value "zoom_friction" double: 0.5;
   value "thumbscroll_border_friction" double: 0.5;
   value "thumbscroll_sensitivity_friction" double: 0.25;
+  value "scroll_smooth_start_enable" uchar: 0;
   value "scroll_smooth_time_interval" double: 0.0;
   value "scroll_smooth_amount" double: 0.0;
   value "scroll_smooth_history_weight" double: 0.1;
index 51ea0ee..53eea72 100644 (file)
@@ -364,6 +364,7 @@ _desc_init(void)
    ELM_CONFIG_VAL(D, T, bring_in_scroll_friction, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, zoom_friction, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, thumbscroll_bounce_enable, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, scroll_smooth_start_enable, T_UCHAR);
    ELM_CONFIG_VAL(D, T, scroll_smooth_time_interval, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, scroll_smooth_amount, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, scroll_smooth_history_weight, T_DOUBLE);
@@ -1073,6 +1074,7 @@ _config_load(void)
    _elm_config->zoom_friction = 0.5;
    _elm_config->thumbscroll_border_friction = 0.5;
    _elm_config->thumbscroll_sensitivity_friction = 0.25; // magic number! just trial and error shows this makes it behave "nicer" and not run off at high speed all the time
+   _elm_config->scroll_smooth_start_enable = EINA_FALSE;
    _elm_config->scroll_smooth_time_interval = 0.008;
    _elm_config->scroll_smooth_amount = 1.0;
    _elm_config->scroll_smooth_history_weight = 0.3;
@@ -1521,6 +1523,8 @@ _env_get(void)
 
         _elm_config->thumbscroll_sensitivity_friction = friction;
      }
+   s = getenv("ELM_SCROLL_SMOOTH_START_ENABLE");
+   if (s) _elm_config->scroll_smooth_start_enable = !!atoi(s);
    s = getenv("ELM_SCROLL_SMOOTH_TIME_INTERVAL");
    if (s) _elm_config->scroll_smooth_time_interval = atof(s);
    s = getenv("ELM_SCROLL_SMOOTH_AMOUNT");
index 7883027..e283f97 100644 (file)
@@ -2638,6 +2638,7 @@ _elm_scroll_mouse_down_event_cb(void *data,
 #else
         sid->down.history[0].timestamp = ecore_loop_time_get();
 #endif
+        sid->down.dragged_began_timestamp = sid->down.history[0].timestamp;
         sid->down.history[0].x = ev->canvas.x;
         sid->down.history[0].y = ev->canvas.y;
      }
@@ -2817,27 +2818,31 @@ _elm_scroll_hold_animator(void *data)
         twin = _elm_config->scroll_smooth_time_window;
         for (i = 0; i < 60; i++)
           {
-             // oldest point is sd->down.history[i]
-             // newset is sd->down.history[0]
-             dt = t - sid->down.history[i].timestamp;
-             if (dt > twin)
+             if (sid->down.history[i].timestamp >
+                 sid->down.dragged_began_timestamp)
                {
-                  i--;
-                  break;
-               }
-             x = sid->down.history[i].x;
-             y = sid->down.history[i].y;
-             _elm_scroll_down_coord_eval(sid, &x, &y);
-             if (i == 0)
-               {
-                  basex = x;
-                  basey = y;
+                  // oldest point is sd->down.history[i]
+                  // newset is sd->down.history[0]
+                  dt = t - sid->down.history[i].timestamp;
+                  if (dt > twin)
+                    {
+                       i--;
+                       break;
+                    }
+                  x = sid->down.history[i].x;
+                  y = sid->down.history[i].y;
+                  _elm_scroll_down_coord_eval(sid, &x, &y);
+                  if (i == 0)
+                    {
+                       basex = x;
+                       basey = y;
+                    }
+                  pos[i].x = x - basex;
+                  pos[i].y = y - basey;
+                  pos[i].t = sid->down.history[i].timestamp - sid->down.history[0].timestamp;
+                  count++;
                }
-             pos[i].x = x - basex;
-             pos[i].y = y - basey;
-             pos[i].t = sid->down.history[i].timestamp - sid->down.history[0].timestamp;
-             count++;
-           }
+          }
         count = i;
         if (count >= 2)
           {
@@ -3081,8 +3086,19 @@ _elm_scroll_mouse_move_event_cb(void *data,
         if ((sid->down.dragged) ||
             (((x * x) + (y * y)) >
              (_elm_config->thumbscroll_threshold *
-                   _elm_config->thumbscroll_threshold)))
+              _elm_config->thumbscroll_threshold)))
           {
+             if (!sid->down.dragged_began &&
+                 _elm_config->scroll_smooth_start_enable)
+               {
+                  sid->down.x = ev->cur.canvas.x;
+                  sid->down.y = ev->cur.canvas.y;
+#ifdef EVTIME
+                  sid->down.dragged_began_timestamp = ev->timestamp / 1000.0;
+#else
+                  sid->down.dragged_began_timestamp = ecore_loop_time_get();
+#endif
+               }
              sid->down.dragged_began = EINA_TRUE;
              if (!sid->down.dragged)
                {
index 48d9871..bee2229 100644 (file)
@@ -1001,6 +1001,7 @@ struct _Elm_Scrollable_Smart_Interface_Data
          double est_timestamp_diff;
       } hist;
 
+      double          dragged_began_timestamp;
       double          anim_start;
       double          anim_start2;
       double          anim_start3;
index dd4481a..6f5d279 100644 (file)
@@ -172,6 +172,7 @@ struct _Elm_Config
    unsigned char thumbscroll_bounce_enable;
    double        thumbscroll_border_friction;
    double        thumbscroll_sensitivity_friction;
+   unsigned char scroll_smooth_start_enable;
    double        scroll_smooth_time_interval;
    double        scroll_smooth_amount;
    double        scroll_smooth_history_weight;