Add the config elm_scroll_smooth_start_enable.

There's no tick when scroller starts scroll if it's set.
This commit is contained in:
Jaehwan Kim 2013-04-30 16:46:59 +09:00
parent 1f82ec7a4a
commit 0bde066596
9 changed files with 51 additions and 20 deletions

View File

@ -1302,3 +1302,8 @@
2013-04-29 ChunEon Park (Hermet) 2013-04-29 ChunEon Park (Hermet)
* Fix toolbar item clipped problem on reordering toolbar item. * 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.

View File

@ -64,6 +64,7 @@ Additions:
* Add elm_access_action(), elm_access_action_cb_set() * 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(). * 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. * Support language,changed callback (Fileselector_Button, Fileselector Entry, Spinner.
* Add the config elm_scroll_smooth_start_enable.
Improvements: Improvements:

View File

@ -17,6 +17,7 @@ group "Elm_Config" struct {
value "zoom_friction" double: 0.5; value "zoom_friction" double: 0.5;
value "thumbscroll_border_friction" double: 0.5; value "thumbscroll_border_friction" double: 0.5;
value "thumbscroll_sensitivity_friction" double: 0.25; 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_time_interval" double: 0.0;
value "scroll_smooth_amount" double: 0.0; value "scroll_smooth_amount" double: 0.0;
value "scroll_smooth_history_weight" double: 0.1; value "scroll_smooth_history_weight" double: 0.1;

View File

@ -17,6 +17,7 @@ group "Elm_Config" struct {
value "zoom_friction" double: 0.5; value "zoom_friction" double: 0.5;
value "thumbscroll_border_friction" double: 0.5; value "thumbscroll_border_friction" double: 0.5;
value "thumbscroll_sensitivity_friction" double: 0.25; value "thumbscroll_sensitivity_friction" double: 0.25;
value "scroll_smooth_start_enable" uchar: 1;
value "scroll_smooth_time_interval" double: 0; value "scroll_smooth_time_interval" double: 0;
value "scroll_smooth_amount" double: 1.0; value "scroll_smooth_amount" double: 1.0;
value "scroll_smooth_history_weight" double: 0.1; value "scroll_smooth_history_weight" double: 0.1;

View File

@ -17,6 +17,7 @@ group "Elm_Config" struct {
value "zoom_friction" double: 0.5; value "zoom_friction" double: 0.5;
value "thumbscroll_border_friction" double: 0.5; value "thumbscroll_border_friction" double: 0.5;
value "thumbscroll_sensitivity_friction" double: 0.25; 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_time_interval" double: 0.0;
value "scroll_smooth_amount" double: 0.0; value "scroll_smooth_amount" double: 0.0;
value "scroll_smooth_history_weight" double: 0.1; value "scroll_smooth_history_weight" double: 0.1;

View File

@ -364,6 +364,7 @@ _desc_init(void)
ELM_CONFIG_VAL(D, T, bring_in_scroll_friction, T_DOUBLE); 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, zoom_friction, T_DOUBLE);
ELM_CONFIG_VAL(D, T, thumbscroll_bounce_enable, T_UCHAR); 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_time_interval, T_DOUBLE);
ELM_CONFIG_VAL(D, T, scroll_smooth_amount, T_DOUBLE); ELM_CONFIG_VAL(D, T, scroll_smooth_amount, T_DOUBLE);
ELM_CONFIG_VAL(D, T, scroll_smooth_history_weight, 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->zoom_friction = 0.5;
_elm_config->thumbscroll_border_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->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_time_interval = 0.008;
_elm_config->scroll_smooth_amount = 1.0; _elm_config->scroll_smooth_amount = 1.0;
_elm_config->scroll_smooth_history_weight = 0.3; _elm_config->scroll_smooth_history_weight = 0.3;
@ -1521,6 +1523,8 @@ _env_get(void)
_elm_config->thumbscroll_sensitivity_friction = friction; _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"); s = getenv("ELM_SCROLL_SMOOTH_TIME_INTERVAL");
if (s) _elm_config->scroll_smooth_time_interval = atof(s); if (s) _elm_config->scroll_smooth_time_interval = atof(s);
s = getenv("ELM_SCROLL_SMOOTH_AMOUNT"); s = getenv("ELM_SCROLL_SMOOTH_AMOUNT");

View File

@ -2638,6 +2638,7 @@ _elm_scroll_mouse_down_event_cb(void *data,
#else #else
sid->down.history[0].timestamp = ecore_loop_time_get(); sid->down.history[0].timestamp = ecore_loop_time_get();
#endif #endif
sid->down.dragged_began_timestamp = sid->down.history[0].timestamp;
sid->down.history[0].x = ev->canvas.x; sid->down.history[0].x = ev->canvas.x;
sid->down.history[0].y = ev->canvas.y; 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; twin = _elm_config->scroll_smooth_time_window;
for (i = 0; i < 60; i++) for (i = 0; i < 60; i++)
{ {
// oldest point is sd->down.history[i] if (sid->down.history[i].timestamp >
// newset is sd->down.history[0] sid->down.dragged_began_timestamp)
dt = t - sid->down.history[i].timestamp;
if (dt > twin)
{ {
i--; // oldest point is sd->down.history[i]
break; // 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++;
} }
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++;
}
count = i; count = i;
if (count >= 2) if (count >= 2)
{ {
@ -3081,8 +3086,19 @@ _elm_scroll_mouse_move_event_cb(void *data,
if ((sid->down.dragged) || if ((sid->down.dragged) ||
(((x * x) + (y * y)) > (((x * x) + (y * y)) >
(_elm_config->thumbscroll_threshold * (_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; sid->down.dragged_began = EINA_TRUE;
if (!sid->down.dragged) if (!sid->down.dragged)
{ {

View File

@ -1001,6 +1001,7 @@ struct _Elm_Scrollable_Smart_Interface_Data
double est_timestamp_diff; double est_timestamp_diff;
} hist; } hist;
double dragged_began_timestamp;
double anim_start; double anim_start;
double anim_start2; double anim_start2;
double anim_start3; double anim_start3;

View File

@ -172,6 +172,7 @@ struct _Elm_Config
unsigned char thumbscroll_bounce_enable; unsigned char thumbscroll_bounce_enable;
double thumbscroll_border_friction; double thumbscroll_border_friction;
double thumbscroll_sensitivity_friction; double thumbscroll_sensitivity_friction;
unsigned char scroll_smooth_start_enable;
double scroll_smooth_time_interval; double scroll_smooth_time_interval;
double scroll_smooth_amount; double scroll_smooth_amount;
double scroll_smooth_history_weight; double scroll_smooth_history_weight;