Make the scroller more "weighted" (or hard-to-drag) while you drag it

out of bounds, that is when the content is finished. In this way
 the user note that the content is at the end.

 All the others finger-scroll implementation (iphone,android) works this way ;)

 This is configurable by the 'thumbscroll_border_friction' config value,
 and by the 'ELM_THUMBSCROLL_BORDER_FRICTION' var.
 0.0 means: disable the friction
 0.5 is the default
 1.0 means: maximum friction

 I have tested this with every scroller in elm_test and seems to work
 well in all the occurence, if you see somthing strange in some scroller
 please let me know.

 DaveMDS
  



SVN revision: 54170
This commit is contained in:
Davide Andreoli 2010-11-05 09:31:51 +00:00
parent 5400a9a7f1
commit 2abf567a5f
6 changed files with 28 additions and 0 deletions

View File

@ -10,6 +10,7 @@ group "Elm_Config" struct {
value "page_scroll_friction" double: 0.5;
value "bring_in_scroll_friction" double: 0.5;
value "zoom_friction" double: 0.5;
value "thumbscroll_border_friction" double: 0.5;
value "scale" double: 1.0;
value "bgpixmap" int: 0;
value "compositing" int: 1;

View File

@ -10,6 +10,7 @@ group "Elm_Config" struct {
value "page_scroll_friction" double: 0.5;
value "bring_in_scroll_friction" double: 0.5;
value "zoom_friction" double: 0.5;
value "thumbscroll_border_friction" double: 0.5;
value "scale" double: 1.0;
value "bgpixmap" int: 0;
value "compositing" int: 1;

View File

@ -10,6 +10,7 @@ group "Elm_Config" struct {
value "page_scroll_friction" double: 0.5;
value "bring_in_scroll_friction" double: 0.5;
value "zoom_friction" double: 0.5;
value "thumbscroll_border_friction" double: 0.5;
value "scale" double: 1.0;
value "bgpixmap" int: 0;
value "compositing" int: 1;

View File

@ -239,6 +239,7 @@ _desc_init(void)
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_bounce_friction, T_DOUBLE);
ELM_CONFIG_VAL(D, T, thumbscroll_border_friction, T_DOUBLE);
ELM_CONFIG_VAL(D, T, page_scroll_friction, T_DOUBLE);
ELM_CONFIG_VAL(D, T, bring_in_scroll_friction, T_DOUBLE);
ELM_CONFIG_VAL(D, T, zoom_friction, T_DOUBLE);
@ -612,6 +613,7 @@ _config_load(void)
_elm_config->thumbscroll_momentum_threshold = 100.0;
_elm_config->thumbscroll_friction = 1.0;
_elm_config->thumbscroll_bounce_friction = 0.5;
_elm_config->thumbscroll_border_friction = 0.5;
_elm_config->page_scroll_friction = 0.5;
_elm_config->bring_in_scroll_friction = 0.5;
_elm_config->zoom_friction = 0.5;
@ -931,6 +933,8 @@ _env_get(void)
if (s) _elm_config->bring_in_scroll_friction = atof(s);
s = getenv("ELM_ZOOM_FRICTION");
if (s) _elm_config->zoom_friction = atof(s);
s = getenv("ELM_THUMBSCROLL_BORDER_FRICTION");
if (s) _elm_config->thumbscroll_border_friction = atof(s);
s = getenv("ELM_THEME");
if (s) eina_stringshare_replace(&_elm_config->theme, s);

View File

@ -80,6 +80,7 @@ struct _Elm_Config
double bring_in_scroll_friction;
double zoom_friction;
Eina_Bool thumbscroll_bounce_enable;
double thumbscroll_border_friction;
double scale;
int bgpixmap;
int compositing;

View File

@ -1842,6 +1842,26 @@ _smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *
else x = sd->down.locked_x;
}
}
if (_elm_config->thumbscroll_border_friction > 0.0)
{
if (y < 0)
y *= _elm_config->thumbscroll_border_friction;
else if (sd->child.h <= sd->h)
y += (sd->down.sy - y) *
_elm_config->thumbscroll_border_friction;
else if ((sd->child.h - sd->h) < y)
y += (sd->child.h - sd->h - y) *
_elm_config->thumbscroll_border_friction;
if (x < 0)
x *= _elm_config->thumbscroll_border_friction;
else if (sd->child.w <= sd->w)
x += (sd->down.sx - x) *
_elm_config->thumbscroll_border_friction;
else if ((sd->child.w - sd->w) < x)
x += (sd->child.w - sd->w - x) *
_elm_config->thumbscroll_border_friction;
}
sd->down.hold_x = x;
sd->down.hold_y = y;
if (!sd->down.hold_animator)