jaehwan pushed a commit to branch master.
commit 4954c65075bf1fae909cfc52d1bbf0efd457b110
Author: Jaehwan Kim <[email protected]>
Date: Tue Apr 30 16:46:59 2013 +0900
Add the config elm_scroll_smooth_start_enable.
There's no tick when scroller starts scroll if it's set.
---
ChangeLog | 5 ++++
NEWS | 1 +
config/default/base.src | 1 +
config/mobile/base.src | 1 +
config/standard/base.src | 1 +
src/lib/elm_config.c | 4 +++
src/lib/elm_interface_scrollable.c | 56 ++++++++++++++++++++++++--------------
src/lib/elm_interface_scrollable.h | 1 +
src/lib/elm_priv.h | 1 +
9 files changed, 51 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ef59b77..fab69bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1302,3 +1302,8 @@
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
--- 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:
diff --git a/config/default/base.src b/config/default/base.src
index 8177b3c..3b396b6 100644
--- a/config/default/base.src
+++ b/config/default/base.src
@@ -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;
diff --git a/config/mobile/base.src b/config/mobile/base.src
index 9037022..ea10161 100644
--- a/config/mobile/base.src
+++ b/config/mobile/base.src
@@ -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;
diff --git a/config/standard/base.src b/config/standard/base.src
index 8bd1a18..65ea080 100644
--- a/config/standard/base.src
+++ b/config/standard/base.src
@@ -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;
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index 51ea0ee..53eea72 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -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");
diff --git a/src/lib/elm_interface_scrollable.c
b/src/lib/elm_interface_scrollable.c
index 7883027..e283f97 100644
--- a/src/lib/elm_interface_scrollable.c
+++ b/src/lib/elm_interface_scrollable.c
@@ -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)
{
diff --git a/src/lib/elm_interface_scrollable.h
b/src/lib/elm_interface_scrollable.h
index 48d9871..bee2229 100644
--- a/src/lib/elm_interface_scrollable.h
+++ b/src/lib/elm_interface_scrollable.h
@@ -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;
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index dd4481a..6f5d279 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -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;
--
------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1