forked from enlightenment/efl
Add the config ELM_THUMBSCROLL_HOLD_THRESHOLD.
This is the number of pixels the range which can be scrolled, while the scroller is holed. In case of mobile, this config is useful since the out of scroller area is too small.
This commit is contained in:
parent
491f47ae61
commit
c36769a9ae
|
@ -1114,3 +1114,7 @@
|
||||||
|
|
||||||
* Add elm_object_item_signal_callback_add(), elm_object_item_signal_callback_del().
|
* Add elm_object_item_signal_callback_add(), elm_object_item_signal_callback_del().
|
||||||
|
|
||||||
|
2013-03-07 Jaehwan Kim
|
||||||
|
|
||||||
|
* Add the config ELM_THUMBSCROLL_HOLD_THRESHOLD.
|
||||||
|
This is the number of pixels the range which can be scrolled, while the scroller is holed.
|
||||||
|
|
|
@ -46,6 +46,7 @@ Additions:
|
||||||
* Add elm_transit_smooth_set(), elm_transit_smooth_get()
|
* Add elm_transit_smooth_set(), elm_transit_smooth_get()
|
||||||
* Add edje_object_message_signal_process before edje_object_size_min_restricted_calc.
|
* Add edje_object_message_signal_process before edje_object_size_min_restricted_calc.
|
||||||
* Add elm_object_item_signal_callback_add(), elm_object_item_signal_callback_del().
|
* Add elm_object_item_signal_callback_add(), elm_object_item_signal_callback_del().
|
||||||
|
* Add the config ELM_THUMBSCROLL_HOLD_THRESHOLD.
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ group "Elm_Config" struct {
|
||||||
value "vsync" uchar: 0;
|
value "vsync" uchar: 0;
|
||||||
value "thumbscroll_enable" uchar: 1;
|
value "thumbscroll_enable" uchar: 1;
|
||||||
value "thumbscroll_threshold" int: 24;
|
value "thumbscroll_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_bounce_friction" double: 0.5;
|
value "thumbscroll_bounce_friction" double: 0.5;
|
||||||
|
|
|
@ -4,6 +4,7 @@ group "Elm_Config" struct {
|
||||||
value "vsync" uchar: 0;
|
value "vsync" uchar: 0;
|
||||||
value "thumbscroll_enable" uchar: 1;
|
value "thumbscroll_enable" uchar: 1;
|
||||||
value "thumbscroll_threshold" int: 24;
|
value "thumbscroll_threshold" int: 24;
|
||||||
|
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_bounce_friction" double: 0.5;
|
value "thumbscroll_bounce_friction" double: 0.5;
|
||||||
|
|
|
@ -4,6 +4,7 @@ group "Elm_Config" struct {
|
||||||
value "vsync" uchar: 0;
|
value "vsync" uchar: 0;
|
||||||
value "thumbscroll_enable" uchar: 0;
|
value "thumbscroll_enable" uchar: 0;
|
||||||
value "thumbscroll_threshold" int: 4;
|
value "thumbscroll_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_bounce_friction" double: 0.5;
|
value "thumbscroll_bounce_friction" double: 0.5;
|
||||||
|
|
|
@ -296,6 +296,31 @@ tst_change(void *data __UNUSED__,
|
||||||
elm_config_all_flush();
|
elm_config_all_flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
tsht_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
|
||||||
|
tsht_change(void *data __UNUSED__,
|
||||||
|
Evas_Object *obj,
|
||||||
|
void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
double tst = elm_config_scroll_thumbscroll_hold_threshold_get();
|
||||||
|
double val = elm_slider_value_get(obj);
|
||||||
|
|
||||||
|
if (tst == val) return;
|
||||||
|
elm_config_scroll_thumbscroll_hold_threshold_set(val);
|
||||||
|
elm_config_all_flush();
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tsmt_round(void *data __UNUSED__,
|
tsmt_round(void *data __UNUSED__,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
|
@ -948,7 +973,7 @@ _font_overlay_change(void *data __UNUSED__,
|
||||||
static void
|
static void
|
||||||
_config_display_update(Evas_Object *win)
|
_config_display_update(Evas_Object *win)
|
||||||
{
|
{
|
||||||
int flush_interval, font_c, image_c, edje_file_c, edje_col_c, ts_threshould;
|
int flush_interval, font_c, image_c, edje_file_c, edje_col_c, ts_threshould, ts_hold_threshold;
|
||||||
double scale, s_bounce_friction, ts_momentum_threshold, ts_friction,
|
double scale, s_bounce_friction, ts_momentum_threshold, ts_friction,
|
||||||
ts_border_friction, ts_sensitivity_friction, page_friction, bring_in_friction, zoom_friction;
|
ts_border_friction, ts_sensitivity_friction, page_friction, bring_in_friction, zoom_friction;
|
||||||
const char *curr_theme, *curr_engine;
|
const char *curr_theme, *curr_engine;
|
||||||
|
@ -970,6 +995,7 @@ _config_display_update(Evas_Object *win)
|
||||||
s_bounce_friction = elm_config_scroll_bounce_friction_get();
|
s_bounce_friction = elm_config_scroll_bounce_friction_get();
|
||||||
ts = elm_config_scroll_thumbscroll_enabled_get();
|
ts = elm_config_scroll_thumbscroll_enabled_get();
|
||||||
ts_threshould = elm_config_scroll_thumbscroll_threshold_get();
|
ts_threshould = elm_config_scroll_thumbscroll_threshold_get();
|
||||||
|
ts_hold_threshold = elm_config_scroll_thumbscroll_hold_threshold_get();
|
||||||
ts_momentum_threshold = elm_config_scroll_thumbscroll_momentum_threshold_get();
|
ts_momentum_threshold = elm_config_scroll_thumbscroll_momentum_threshold_get();
|
||||||
ts_friction = elm_config_scroll_thumbscroll_friction_get();
|
ts_friction = elm_config_scroll_thumbscroll_friction_get();
|
||||||
ts_border_friction = elm_config_scroll_thumbscroll_border_friction_get();
|
ts_border_friction = elm_config_scroll_thumbscroll_border_friction_get();
|
||||||
|
@ -1003,6 +1029,9 @@ _config_display_update(Evas_Object *win)
|
||||||
elm_slider_value_set(evas_object_data_get(win,
|
elm_slider_value_set(evas_object_data_get(win,
|
||||||
"thumbscroll_threshold_slider"),
|
"thumbscroll_threshold_slider"),
|
||||||
ts_threshould);
|
ts_threshould);
|
||||||
|
elm_slider_value_set(evas_object_data_get(win,
|
||||||
|
"ts_hold_threshold_slider"),
|
||||||
|
ts_hold_threshold);
|
||||||
elm_slider_value_set(evas_object_data_get(win,
|
elm_slider_value_set(evas_object_data_get(win,
|
||||||
"ts_momentum_threshold_slider"),
|
"ts_momentum_threshold_slider"),
|
||||||
ts_momentum_threshold);
|
ts_momentum_threshold);
|
||||||
|
@ -2618,6 +2647,26 @@ _status_config_scrolling(Evas_Object *win,
|
||||||
evas_object_smart_callback_add(sl, "changed", tst_round, NULL);
|
evas_object_smart_callback_add(sl, "changed", tst_round, NULL);
|
||||||
evas_object_smart_callback_add(sl, "delay,changed", tst_change, NULL);
|
evas_object_smart_callback_add(sl, "delay,changed", tst_change, NULL);
|
||||||
|
|
||||||
|
LABEL_FRAME_ADD("<hilight>Thumb scroll hold threshold</>");
|
||||||
|
|
||||||
|
sl = elm_slider_add(win);
|
||||||
|
elm_object_tooltip_text_set(sl, "This is the number of pixels the range<br/>"
|
||||||
|
"which can be scrolled, while the scroller<br/>"
|
||||||
|
"is holed");
|
||||||
|
evas_object_data_set(win, "thumbscroll_hold_threshold_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 pixels");
|
||||||
|
elm_slider_indicator_format_set(sl, "%1.0f");
|
||||||
|
elm_slider_min_max_set(sl, 4.0, 500.0);
|
||||||
|
elm_slider_value_set(sl, elm_config_scroll_thumbscroll_threshold_get());
|
||||||
|
elm_box_pack_end(bx, sl);
|
||||||
|
evas_object_show(sl);
|
||||||
|
|
||||||
|
evas_object_smart_callback_add(sl, "changed", tsht_round, NULL);
|
||||||
|
evas_object_smart_callback_add(sl, "delay,changed", tsht_change, NULL);
|
||||||
|
|
||||||
LABEL_FRAME_ADD("<hilight>Thumb scroll momentum threshold</>");
|
LABEL_FRAME_ADD("<hilight>Thumb scroll momentum threshold</>");
|
||||||
|
|
||||||
sl = elm_slider_add(win);
|
sl = elm_slider_add(win);
|
||||||
|
|
|
@ -350,6 +350,7 @@ _desc_init(void)
|
||||||
ELM_CONFIG_VAL(D, T, vsync, T_UCHAR);
|
ELM_CONFIG_VAL(D, T, vsync, T_UCHAR);
|
||||||
ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR);
|
ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR);
|
||||||
ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT);
|
ELM_CONFIG_VAL(D, T, thumbscroll_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_bounce_friction, T_DOUBLE);
|
ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE);
|
||||||
|
@ -1055,6 +1056,7 @@ _config_load(void)
|
||||||
_elm_config->vsync = 0;
|
_elm_config->vsync = 0;
|
||||||
_elm_config->thumbscroll_enable = EINA_TRUE;
|
_elm_config->thumbscroll_enable = EINA_TRUE;
|
||||||
_elm_config->thumbscroll_threshold = 24;
|
_elm_config->thumbscroll_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_bounce_friction = 0.5;
|
_elm_config->thumbscroll_bounce_friction = 0.5;
|
||||||
|
@ -1465,6 +1467,8 @@ _env_get(void)
|
||||||
if (s) _elm_config->thumbscroll_enable = !!atoi(s);
|
if (s) _elm_config->thumbscroll_enable = !!atoi(s);
|
||||||
s = getenv("ELM_THUMBSCROLL_THRESHOLD");
|
s = getenv("ELM_THUMBSCROLL_THRESHOLD");
|
||||||
if (s) _elm_config->thumbscroll_threshold = atoi(s);
|
if (s) _elm_config->thumbscroll_threshold = atoi(s);
|
||||||
|
s = getenv("ELM_THUMBSCROLL_HOLD_THRESHOLD");
|
||||||
|
if (s) _elm_config->thumbscroll_hold_threshold = atoi(s);
|
||||||
// FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0
|
// FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0
|
||||||
s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
|
s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
|
||||||
if (s) _elm_config->thumbscroll_momentum_threshold = _elm_atof(s);
|
if (s) _elm_config->thumbscroll_momentum_threshold = _elm_atof(s);
|
||||||
|
@ -2100,6 +2104,18 @@ elm_config_scroll_thumbscroll_threshold_set(unsigned int threshold)
|
||||||
_elm_config->thumbscroll_threshold = threshold;
|
_elm_config->thumbscroll_threshold = threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI unsigned int
|
||||||
|
elm_config_scroll_thumbscroll_hold_threshold_get(void)
|
||||||
|
{
|
||||||
|
return _elm_config->thumbscroll_hold_threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
elm_config_scroll_thumbscroll_hold_threshold_set(unsigned int threshold)
|
||||||
|
{
|
||||||
|
_elm_config->thumbscroll_hold_threshold = threshold;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI double
|
EAPI double
|
||||||
elm_config_scroll_thumbscroll_momentum_threshold_get(void)
|
elm_config_scroll_thumbscroll_momentum_threshold_get(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -305,6 +305,27 @@ EAPI unsigned int elm_config_scroll_thumbscroll_threshold_get(void);
|
||||||
*/
|
*/
|
||||||
EAPI void elm_config_scroll_thumbscroll_threshold_set(unsigned int threshold);
|
EAPI void elm_config_scroll_thumbscroll_threshold_set(unsigned int threshold);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of pixels the range which can be scrolled,
|
||||||
|
* while the scroller is holded.
|
||||||
|
*
|
||||||
|
* @return the thumb scroll hold threshold
|
||||||
|
*
|
||||||
|
* @ingroup Scrolling
|
||||||
|
*/
|
||||||
|
EAPI unsigned int elm_config_scroll_thumbscroll_hold_threshold_get(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of pixels the range which can be scrolled,
|
||||||
|
* while the scroller is holded.
|
||||||
|
*
|
||||||
|
* @param threshold the thumb scroll hold threshold
|
||||||
|
*
|
||||||
|
* @see elm_config_thumbscroll_hold_threshold_get()
|
||||||
|
* @ingroup Scrolling
|
||||||
|
*/
|
||||||
|
EAPI void elm_config_scroll_thumbscroll_hold_threshold_set(unsigned int threshold);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the minimum speed of mouse cursor movement which will trigger
|
* Get the minimum speed of mouse cursor movement which will trigger
|
||||||
* list self scrolling animation after a mouse up event
|
* list self scrolling animation after a mouse up event
|
||||||
|
|
|
@ -2804,9 +2804,9 @@ _elm_scroll_on_hold_animator(void *data)
|
||||||
{
|
{
|
||||||
td = t - sid->down.onhold_tlast;
|
td = t - sid->down.onhold_tlast;
|
||||||
vx = sid->down.onhold_vx * td *
|
vx = sid->down.onhold_vx * td *
|
||||||
(double)_elm_config->thumbscroll_threshold * 2.0;
|
(double)_elm_config->thumbscroll_hold_threshold * 2.0;
|
||||||
vy = sid->down.onhold_vy * td *
|
vy = sid->down.onhold_vy * td *
|
||||||
(double)_elm_config->thumbscroll_threshold * 2.0;
|
(double)_elm_config->thumbscroll_hold_threshold * 2.0;
|
||||||
eo_do(sid->obj, elm_scrollable_interface_content_pos_get(&ox, &oy));
|
eo_do(sid->obj, elm_scrollable_interface_content_pos_get(&ox, &oy));
|
||||||
x = ox;
|
x = ox;
|
||||||
y = oy;
|
y = oy;
|
||||||
|
@ -3045,37 +3045,37 @@ _elm_scroll_mouse_move_event_cb(void *data,
|
||||||
|
|
||||||
x = ev->cur.canvas.x - sid->x;
|
x = ev->cur.canvas.x - sid->x;
|
||||||
y = ev->cur.canvas.y - sid->y;
|
y = ev->cur.canvas.y - sid->y;
|
||||||
if (x < _elm_config->thumbscroll_threshold)
|
if (x < _elm_config->thumbscroll_hold_threshold)
|
||||||
{
|
{
|
||||||
if (_elm_config->thumbscroll_threshold > 0.0)
|
if (_elm_config->thumbscroll_hold_threshold > 0.0)
|
||||||
vx = -(double)(_elm_config->thumbscroll_threshold - x)
|
vx = -(double)(_elm_config->thumbscroll_hold_threshold - x)
|
||||||
/ _elm_config->thumbscroll_threshold;
|
/ _elm_config->thumbscroll_hold_threshold;
|
||||||
else
|
else
|
||||||
vx = -1.0;
|
vx = -1.0;
|
||||||
}
|
}
|
||||||
else if (x > (sid->w - _elm_config->thumbscroll_threshold))
|
else if (x > (sid->w - _elm_config->thumbscroll_hold_threshold))
|
||||||
{
|
{
|
||||||
if (_elm_config->thumbscroll_threshold > 0.0)
|
if (_elm_config->thumbscroll_hold_threshold > 0.0)
|
||||||
vx = (double)(_elm_config->thumbscroll_threshold -
|
vx = (double)(_elm_config->thumbscroll_hold_threshold -
|
||||||
(sid->w - x)) /
|
(sid->w - x)) /
|
||||||
_elm_config->thumbscroll_threshold;
|
_elm_config->thumbscroll_hold_threshold;
|
||||||
else
|
else
|
||||||
vx = 1.0;
|
vx = 1.0;
|
||||||
}
|
}
|
||||||
if (y < _elm_config->thumbscroll_threshold)
|
if (y < _elm_config->thumbscroll_hold_threshold)
|
||||||
{
|
{
|
||||||
if (_elm_config->thumbscroll_threshold > 0.0)
|
if (_elm_config->thumbscroll_hold_threshold > 0.0)
|
||||||
vy = -(double)(_elm_config->thumbscroll_threshold - y)
|
vy = -(double)(_elm_config->thumbscroll_hold_threshold - y)
|
||||||
/ _elm_config->thumbscroll_threshold;
|
/ _elm_config->thumbscroll_hold_threshold;
|
||||||
else
|
else
|
||||||
vy = -1.0;
|
vy = -1.0;
|
||||||
}
|
}
|
||||||
else if (y > (sid->h - _elm_config->thumbscroll_threshold))
|
else if (y > (sid->h - _elm_config->thumbscroll_hold_threshold))
|
||||||
{
|
{
|
||||||
if (_elm_config->thumbscroll_threshold > 0.0)
|
if (_elm_config->thumbscroll_hold_threshold > 0.0)
|
||||||
vy = (double)(_elm_config->thumbscroll_threshold -
|
vy = (double)(_elm_config->thumbscroll_hold_threshold -
|
||||||
(sid->h - y)) /
|
(sid->h - y)) /
|
||||||
_elm_config->thumbscroll_threshold;
|
_elm_config->thumbscroll_hold_threshold;
|
||||||
else
|
else
|
||||||
vy = 1.0;
|
vy = 1.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,6 +159,7 @@ struct _Elm_Config
|
||||||
unsigned char vsync;
|
unsigned char vsync;
|
||||||
unsigned char thumbscroll_enable;
|
unsigned char thumbscroll_enable;
|
||||||
int thumbscroll_threshold;
|
int thumbscroll_threshold;
|
||||||
|
int thumbscroll_hold_threshold;
|
||||||
double thumbscroll_momentum_threshold;
|
double thumbscroll_momentum_threshold;
|
||||||
double thumbscroll_friction;
|
double thumbscroll_friction;
|
||||||
double thumbscroll_bounce_friction;
|
double thumbscroll_bounce_friction;
|
||||||
|
|
Loading…
Reference in New Issue