forked from enlightenment/efl
The momentum animation time is changed as the amount of flick.
This commit is contained in:
parent
fb78d7dbd3
commit
4ff2af7335
|
@ -1312,3 +1312,6 @@
|
||||||
|
|
||||||
* Layout supports "language,changed" smart callback.
|
* Layout supports "language,changed" smart callback.
|
||||||
|
|
||||||
|
2013-04-30 Jaehwan Kim
|
||||||
|
|
||||||
|
* The momentum animation time is changed as the amount of flick.
|
||||||
|
|
|
@ -66,6 +66,7 @@ Additions:
|
||||||
* 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.
|
* Add the config elm_scroll_smooth_start_enable.
|
||||||
* Add elm_layout smart callback - "language,changed".
|
* Add elm_layout smart callback - "language,changed".
|
||||||
|
* The momentum animation time is changed as the amount of flick.
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ group "Elm_Config" struct {
|
||||||
value "thumbscroll_hold_threshold" int: 24;
|
value "thumbscroll_hold_threshold" int: 24;
|
||||||
value "thumbscroll_momentum_threshold" double: 100.0;
|
value "thumbscroll_momentum_threshold" double: 100.0;
|
||||||
value "thumbscroll_friction" double: 1.0;
|
value "thumbscroll_friction" double: 1.0;
|
||||||
|
value "thumbscroll_min_friction" double: 1.0;
|
||||||
|
value "thumbscroll_friction_standard" double: 2000.0;
|
||||||
value "thumbscroll_bounce_friction" double: 0.5;
|
value "thumbscroll_bounce_friction" double: 0.5;
|
||||||
value "thumbscroll_bounce_enable" uchar: 1;
|
value "thumbscroll_bounce_enable" uchar: 1;
|
||||||
value "thumbscroll_acceleration_threshold" double: 500.0;
|
value "thumbscroll_acceleration_threshold" double: 500.0;
|
||||||
|
|
|
@ -7,6 +7,8 @@ group "Elm_Config" struct {
|
||||||
value "thumbscroll_hold_threshold" int: 100;
|
value "thumbscroll_hold_threshold" int: 100;
|
||||||
value "thumbscroll_momentum_threshold" double: 100.0;
|
value "thumbscroll_momentum_threshold" double: 100.0;
|
||||||
value "thumbscroll_friction" double: 1.0;
|
value "thumbscroll_friction" double: 1.0;
|
||||||
|
value "thumbscroll_min_friction" double: 0.3;
|
||||||
|
value "thumbscroll_friction_standard" double: 3000.0;
|
||||||
value "thumbscroll_bounce_friction" double: 0.5;
|
value "thumbscroll_bounce_friction" double: 0.5;
|
||||||
value "thumbscroll_bounce_enable" uchar: 1;
|
value "thumbscroll_bounce_enable" uchar: 1;
|
||||||
value "thumbscroll_acceleration_threshold" double: 2000.0;
|
value "thumbscroll_acceleration_threshold" double: 2000.0;
|
||||||
|
|
|
@ -7,6 +7,8 @@ group "Elm_Config" struct {
|
||||||
value "thumbscroll_hold_threshold" int: 4;
|
value "thumbscroll_hold_threshold" int: 4;
|
||||||
value "thumbscroll_momentum_threshold" double: 100.0;
|
value "thumbscroll_momentum_threshold" double: 100.0;
|
||||||
value "thumbscroll_friction" double: 1.0;
|
value "thumbscroll_friction" double: 1.0;
|
||||||
|
value "thumbscroll_min_friction" double: 1.0;
|
||||||
|
value "thumbscroll_friction_standard" double: 2000.0;
|
||||||
value "thumbscroll_bounce_friction" double: 0.5;
|
value "thumbscroll_bounce_friction" double: 0.5;
|
||||||
value "thumbscroll_bounce_enable" uchar: 0;
|
value "thumbscroll_bounce_enable" uchar: 0;
|
||||||
value "thumbscroll_acceleration_threshold" double: 500.0;
|
value "thumbscroll_acceleration_threshold" double: 500.0;
|
||||||
|
|
|
@ -371,6 +371,56 @@ tsf_change(void *data __UNUSED__,
|
||||||
elm_config_all_flush();
|
elm_config_all_flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
tsmf_round(void *data __UNUSED__,
|
||||||
|
Evas_Object *obj,
|
||||||
|
void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
double val = elm_slider_value_get(obj);
|
||||||
|
double v;
|
||||||
|
|
||||||
|
v = ((double)((int)(val * 10.0))) / 10.0;
|
||||||
|
if (v != val) elm_slider_value_set(obj, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
tsmf_change(void *data __UNUSED__,
|
||||||
|
Evas_Object *obj,
|
||||||
|
void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
double tsmf = elm_config_scroll_thumbscroll_min_friction_get();
|
||||||
|
double val = elm_slider_value_get(obj);
|
||||||
|
|
||||||
|
if (tsmf == val) return;
|
||||||
|
elm_config_scroll_thumbscroll_min_friction_set(val);
|
||||||
|
elm_config_all_flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
tsfs_round(void *data __UNUSED__,
|
||||||
|
Evas_Object *obj,
|
||||||
|
void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
double val = elm_slider_value_get(obj);
|
||||||
|
double v;
|
||||||
|
|
||||||
|
v = ((double)((int)(val * 10.0))) / 10.0;
|
||||||
|
if (v != val) elm_slider_value_set(obj, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
tsfs_change(void *data __UNUSED__,
|
||||||
|
Evas_Object *obj,
|
||||||
|
void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
double tsfs = elm_config_scroll_thumbscroll_friction_standard_get();
|
||||||
|
double val = elm_slider_value_get(obj);
|
||||||
|
|
||||||
|
if (tsfs == val) return;
|
||||||
|
elm_config_scroll_thumbscroll_friction_standard_set(val);
|
||||||
|
elm_config_all_flush();
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tsbf_round(void *data __UNUSED__,
|
tsbf_round(void *data __UNUSED__,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
|
@ -2794,6 +2844,47 @@ _status_config_scrolling(Evas_Object *win,
|
||||||
evas_object_smart_callback_add(sl, "changed", tsf_round, NULL);
|
evas_object_smart_callback_add(sl, "changed", tsf_round, NULL);
|
||||||
evas_object_smart_callback_add(sl, "delay,changed", tsf_change, NULL);
|
evas_object_smart_callback_add(sl, "delay,changed", tsf_change, NULL);
|
||||||
|
|
||||||
|
LABEL_FRAME_ADD("<hilight>Thumb scroll min friction</>");
|
||||||
|
|
||||||
|
sl = elm_slider_add(win);
|
||||||
|
elm_object_tooltip_text_set(sl, "This is the min amount of inertia a<br/>"
|
||||||
|
"scroller will impose at self scrolling<br/>"
|
||||||
|
"animations");
|
||||||
|
evas_object_data_set(win, "thumbscroll_min_friction_slider", sl);
|
||||||
|
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
|
||||||
|
elm_slider_span_size_set(sl, 120);
|
||||||
|
elm_slider_unit_format_set(sl, "%1.1f");
|
||||||
|
elm_slider_indicator_format_set(sl, "%1.1f");
|
||||||
|
elm_slider_min_max_set(sl, 0.0, 15.0);
|
||||||
|
elm_slider_value_set(sl, elm_config_scroll_thumbscroll_min_friction_get());
|
||||||
|
elm_box_pack_end(bx, sl);
|
||||||
|
evas_object_show(sl);
|
||||||
|
|
||||||
|
evas_object_smart_callback_add(sl, "changed", tsmf_round, NULL);
|
||||||
|
evas_object_smart_callback_add(sl, "delay,changed", tsmf_change, NULL);
|
||||||
|
|
||||||
|
LABEL_FRAME_ADD("<hilight>Thumb scroll friction standard</>");
|
||||||
|
|
||||||
|
sl = elm_slider_add(win);
|
||||||
|
elm_object_tooltip_text_set(sl, "This is the standard velocity of the scroller."
|
||||||
|
"<br/>The scroll animation time is same<br/>"
|
||||||
|
"with thumbscroll friction, if the velocity"
|
||||||
|
"<br/>is same with standard velocity.");
|
||||||
|
evas_object_data_set(win, "thumbscroll_friction_standard_slider", sl);
|
||||||
|
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
|
||||||
|
elm_slider_span_size_set(sl, 120);
|
||||||
|
elm_slider_unit_format_set(sl, "%1.0f pixel/s");
|
||||||
|
elm_slider_indicator_format_set(sl, "%1.0f");
|
||||||
|
elm_slider_min_max_set(sl, 10.0, 5000.0);
|
||||||
|
elm_slider_value_set(sl, elm_config_scroll_thumbscroll_friction_standard_get());
|
||||||
|
elm_box_pack_end(bx, sl);
|
||||||
|
evas_object_show(sl);
|
||||||
|
|
||||||
|
evas_object_smart_callback_add(sl, "changed", tsfs_round, NULL);
|
||||||
|
evas_object_smart_callback_add(sl, "delay,changed", tsfs_change, NULL);
|
||||||
|
|
||||||
LABEL_FRAME_ADD("<hilight>Thumb scroll border friction</>");
|
LABEL_FRAME_ADD("<hilight>Thumb scroll border friction</>");
|
||||||
|
|
||||||
sl = elm_slider_add(win);
|
sl = elm_slider_add(win);
|
||||||
|
|
|
@ -354,6 +354,8 @@ _desc_init(void)
|
||||||
ELM_CONFIG_VAL(D, T, thumbscroll_hold_threshold, T_INT);
|
ELM_CONFIG_VAL(D, T, thumbscroll_hold_threshold, T_INT);
|
||||||
ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE);
|
ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE);
|
||||||
ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE);
|
ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE);
|
||||||
|
ELM_CONFIG_VAL(D, T, thumbscroll_min_friction, T_DOUBLE);
|
||||||
|
ELM_CONFIG_VAL(D, T, thumbscroll_friction_standard, T_DOUBLE);
|
||||||
ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE);
|
ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE);
|
||||||
ELM_CONFIG_VAL(D, T, thumbscroll_border_friction, T_DOUBLE);
|
ELM_CONFIG_VAL(D, T, thumbscroll_border_friction, T_DOUBLE);
|
||||||
ELM_CONFIG_VAL(D, T, thumbscroll_sensitivity_friction, T_DOUBLE);
|
ELM_CONFIG_VAL(D, T, thumbscroll_sensitivity_friction, T_DOUBLE);
|
||||||
|
@ -1064,6 +1066,8 @@ _config_load(void)
|
||||||
_elm_config->thumbscroll_hold_threshold = 24;
|
_elm_config->thumbscroll_hold_threshold = 24;
|
||||||
_elm_config->thumbscroll_momentum_threshold = 100.0;
|
_elm_config->thumbscroll_momentum_threshold = 100.0;
|
||||||
_elm_config->thumbscroll_friction = 1.0;
|
_elm_config->thumbscroll_friction = 1.0;
|
||||||
|
_elm_config->thumbscroll_min_friction = 0.5;
|
||||||
|
_elm_config->thumbscroll_friction_standard = 1000.0;
|
||||||
_elm_config->thumbscroll_bounce_friction = 0.5;
|
_elm_config->thumbscroll_bounce_friction = 0.5;
|
||||||
_elm_config->thumbscroll_bounce_enable = EINA_TRUE;
|
_elm_config->thumbscroll_bounce_enable = EINA_TRUE;
|
||||||
_elm_config->thumbscroll_acceleration_threshold = 500.0;
|
_elm_config->thumbscroll_acceleration_threshold = 500.0;
|
||||||
|
@ -1483,6 +1487,10 @@ _env_get(void)
|
||||||
if (s) _elm_config->thumbscroll_momentum_threshold = _elm_atof(s);
|
if (s) _elm_config->thumbscroll_momentum_threshold = _elm_atof(s);
|
||||||
s = getenv("ELM_THUMBSCROLL_FRICTION");
|
s = getenv("ELM_THUMBSCROLL_FRICTION");
|
||||||
if (s) _elm_config->thumbscroll_friction = _elm_atof(s);
|
if (s) _elm_config->thumbscroll_friction = _elm_atof(s);
|
||||||
|
s = getenv("ELM_THUMBSCROLL_MIN_FRICTION");
|
||||||
|
if (s) _elm_config->thumbscroll_min_friction = _elm_atof(s);
|
||||||
|
s = getenv("ELM_THUMBSCROLL_FRICTION_STANDARD");
|
||||||
|
if (s) _elm_config->thumbscroll_friction_standard = _elm_atof(s);
|
||||||
s = getenv("ELM_THUMBSCROLL_BOUNCE_ENABLE");
|
s = getenv("ELM_THUMBSCROLL_BOUNCE_ENABLE");
|
||||||
if (s) _elm_config->thumbscroll_bounce_enable = !!atoi(s);
|
if (s) _elm_config->thumbscroll_bounce_enable = !!atoi(s);
|
||||||
s = getenv("ELM_THUMBSCROLL_BOUNCE_FRICTION");
|
s = getenv("ELM_THUMBSCROLL_BOUNCE_FRICTION");
|
||||||
|
@ -2157,6 +2165,30 @@ elm_config_scroll_thumbscroll_friction_set(double friction)
|
||||||
_elm_config->thumbscroll_friction = friction;
|
_elm_config->thumbscroll_friction = friction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI double
|
||||||
|
elm_config_scroll_thumbscroll_min_friction_get(void)
|
||||||
|
{
|
||||||
|
return _elm_config->thumbscroll_min_friction;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
elm_config_scroll_thumbscroll_min_friction_set(double friction)
|
||||||
|
{
|
||||||
|
_elm_config->thumbscroll_min_friction = friction;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI double
|
||||||
|
elm_config_scroll_thumbscroll_friction_standard_get(void)
|
||||||
|
{
|
||||||
|
return _elm_config->thumbscroll_friction_standard;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
elm_config_scroll_thumbscroll_friction_standard_set(double standard)
|
||||||
|
{
|
||||||
|
_elm_config->thumbscroll_friction_standard = standard;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI double
|
EAPI double
|
||||||
elm_config_scroll_thumbscroll_border_friction_get(void)
|
elm_config_scroll_thumbscroll_border_friction_get(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -370,6 +370,50 @@ EAPI double elm_config_scroll_thumbscroll_friction_get(void);
|
||||||
*/
|
*/
|
||||||
EAPI void elm_config_scroll_thumbscroll_friction_set(double friction);
|
EAPI void elm_config_scroll_thumbscroll_friction_set(double friction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the min amount of inertia a scroller will impose at self scrolling
|
||||||
|
* animations.
|
||||||
|
*
|
||||||
|
* @return the thumb scroll min friction
|
||||||
|
*
|
||||||
|
* @ingroup Scrolling
|
||||||
|
*/
|
||||||
|
EAPI double elm_config_scroll_thumbscroll_min_friction_get(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the min amount of inertia a scroller will impose at self scrolling
|
||||||
|
* animations.
|
||||||
|
*
|
||||||
|
* @param friction the thumb scroll min friction
|
||||||
|
*
|
||||||
|
* @see elm_config_thumbscroll_min_friction_get()
|
||||||
|
* @ingroup Scrolling
|
||||||
|
*/
|
||||||
|
EAPI void elm_config_scroll_thumbscroll_min_friction_set(double friction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the standard velocity of the scroller. The scroll animation time is
|
||||||
|
* same with thumbscroll friction, if the velocity is same with standard
|
||||||
|
* velocity.
|
||||||
|
*
|
||||||
|
* @return the thumb scroll friction
|
||||||
|
*
|
||||||
|
* @ingroup Scrolling
|
||||||
|
*/
|
||||||
|
EAPI double elm_config_scroll_thumbscroll_friction_standard_get(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the standard velocity of the scroller. The scroll animation time is
|
||||||
|
* same with thumbscroll friction, if the velocity is same with standard
|
||||||
|
* velocity.
|
||||||
|
*
|
||||||
|
* @param friction the thumb scroll friction standard
|
||||||
|
*
|
||||||
|
* @see elm_config_thumbscroll_friction_standard_get()
|
||||||
|
* @ingroup Scrolling
|
||||||
|
*/
|
||||||
|
EAPI void elm_config_scroll_thumbscroll_friction_standard_set(double standard);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the amount of lag between your actual mouse cursor dragging
|
* Get the amount of lag between your actual mouse cursor dragging
|
||||||
* movement and a scroller's view movement itself, while pushing it
|
* movement and a scroller's view movement itself, while pushing it
|
||||||
|
|
|
@ -1966,7 +1966,7 @@ _paging_is_enabled(Elm_Scrollable_Smart_Interface_Data *sid)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_elm_scroll_momentum_animator(void *data)
|
_elm_scroll_momentum_animator(void *data)
|
||||||
{
|
{
|
||||||
double t, dt, p;
|
double t, at, dt, p, r;
|
||||||
Elm_Scrollable_Smart_Interface_Data *sid = data;
|
Elm_Scrollable_Smart_Interface_Data *sid = data;
|
||||||
Evas_Coord x, y, dx, dy, px, py, maxx, maxy, minx, miny;
|
Evas_Coord x, y, dx, dy, px, py, maxx, maxy, minx, miny;
|
||||||
Eina_Bool no_bounce_x_end = EINA_FALSE, no_bounce_y_end = EINA_FALSE;
|
Eina_Bool no_bounce_x_end = EINA_FALSE, no_bounce_y_end = EINA_FALSE;
|
||||||
|
@ -1977,7 +1977,14 @@ _elm_scroll_momentum_animator(void *data)
|
||||||
dt = t - sid->down.anim_start;
|
dt = t - sid->down.anim_start;
|
||||||
if (dt >= 0.0)
|
if (dt >= 0.0)
|
||||||
{
|
{
|
||||||
dt = dt / (_elm_config->thumbscroll_friction + sid->down.extra_time);
|
r = _elm_config->thumbscroll_min_friction / _elm_config->thumbscroll_friction;
|
||||||
|
at = (double)sqrt(
|
||||||
|
(sid->down.dx * sid->down.dx) + (sid->down.dy * sid->down.dy));
|
||||||
|
at = at < ((1.0 - r) * _elm_config->thumbscroll_friction_standard) ?
|
||||||
|
at : (1.0 - r) * _elm_config->thumbscroll_friction_standard;
|
||||||
|
at = ((at / _elm_config->thumbscroll_friction_standard) + r) *
|
||||||
|
(_elm_config->thumbscroll_friction + sid->down.extra_time);
|
||||||
|
dt = dt / at;
|
||||||
if (dt > 1.0) dt = 1.0;
|
if (dt > 1.0) dt = 1.0;
|
||||||
p = 1.0 - ((1.0 - dt) * (1.0 - dt));
|
p = 1.0 - ((1.0 - dt) * (1.0 - dt));
|
||||||
dx = (sid->down.dx * (_elm_config->thumbscroll_friction +
|
dx = (sid->down.dx * (_elm_config->thumbscroll_friction +
|
||||||
|
|
|
@ -162,6 +162,8 @@ struct _Elm_Config
|
||||||
int thumbscroll_hold_threshold;
|
int thumbscroll_hold_threshold;
|
||||||
double thumbscroll_momentum_threshold;
|
double thumbscroll_momentum_threshold;
|
||||||
double thumbscroll_friction;
|
double thumbscroll_friction;
|
||||||
|
double thumbscroll_min_friction;
|
||||||
|
double thumbscroll_friction_standard;
|
||||||
double thumbscroll_bounce_friction;
|
double thumbscroll_bounce_friction;
|
||||||
double thumbscroll_acceleration_threshold;
|
double thumbscroll_acceleration_threshold;
|
||||||
double thumbscroll_acceleration_time_limit;
|
double thumbscroll_acceleration_time_limit;
|
||||||
|
|
Loading…
Reference in New Issue