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.
* 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.
* Add elm_transit_smooth_set(), elm_transit_smooth_get()
* 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 the config ELM_THUMBSCROLL_HOLD_THRESHOLD.
Improvements:
value "vsync" uchar: 0;
value "thumbscroll_enable" uchar: 1;
value "thumbscroll_threshold" int: 24;
+ value "thumbscroll_hold_threshold" int: 24;
value "thumbscroll_momentum_threshold" double: 100.0;
value "thumbscroll_friction" double: 1.0;
value "thumbscroll_bounce_friction" double: 0.5;
value "vsync" uchar: 0;
value "thumbscroll_enable" uchar: 1;
value "thumbscroll_threshold" int: 24;
+ value "thumbscroll_hold_threshold" int: 100;
value "thumbscroll_momentum_threshold" double: 100.0;
value "thumbscroll_friction" double: 1.0;
value "thumbscroll_bounce_friction" double: 0.5;
value "vsync" uchar: 0;
value "thumbscroll_enable" uchar: 0;
value "thumbscroll_threshold" int: 4;
+ value "thumbscroll_hold_threshold" int: 4;
value "thumbscroll_momentum_threshold" double: 100.0;
value "thumbscroll_friction" double: 1.0;
value "thumbscroll_bounce_friction" double: 0.5;
}
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
tsmt_round(void *data __UNUSED__,
Evas_Object *obj,
void *event_info __UNUSED__)
static void
_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,
ts_border_friction, ts_sensitivity_friction, page_friction, bring_in_friction, zoom_friction;
const char *curr_theme, *curr_engine;
s_bounce_friction = elm_config_scroll_bounce_friction_get();
ts = elm_config_scroll_thumbscroll_enabled_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_friction = elm_config_scroll_thumbscroll_friction_get();
ts_border_friction = elm_config_scroll_thumbscroll_border_friction_get();
"thumbscroll_threshold_slider"),
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,
"ts_momentum_threshold_slider"),
ts_momentum_threshold);
elm_slider_value_set(evas_object_data_get(win,
evas_object_smart_callback_add(sl, "changed", tst_round, 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</>");
sl = elm_slider_add(win);
ELM_CONFIG_VAL(D, T, vsync, 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_hold_threshold, T_INT);
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->vsync = 0;
_elm_config->thumbscroll_enable = EINA_TRUE;
_elm_config->thumbscroll_threshold = 24;
+ _elm_config->thumbscroll_hold_threshold = 24;
_elm_config->thumbscroll_momentum_threshold = 100.0;
_elm_config->thumbscroll_friction = 1.0;
_elm_config->thumbscroll_bounce_friction = 0.5;
if (s) _elm_config->thumbscroll_enable = !!atoi(s);
s = getenv("ELM_THUMBSCROLL_THRESHOLD");
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
s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
if (s) _elm_config->thumbscroll_momentum_threshold = _elm_atof(s);
_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
elm_config_scroll_thumbscroll_momentum_threshold_get(void)
{
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
* list self scrolling animation after a mouse up event
* (pixels/second).
{
td = t - sid->down.onhold_tlast;
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 *
- (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));
x = ox;
y = oy;
x = ev->cur.canvas.x - sid->x;
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)
- vx = -(double)(_elm_config->thumbscroll_threshold - x)
- / _elm_config->thumbscroll_threshold;
+ if (_elm_config->thumbscroll_hold_threshold > 0.0)
+ vx = -(double)(_elm_config->thumbscroll_hold_threshold - x)
+ / _elm_config->thumbscroll_hold_threshold;
else
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)
- vx = (double)(_elm_config->thumbscroll_threshold -
+ if (_elm_config->thumbscroll_hold_threshold > 0.0)
+ vx = (double)(_elm_config->thumbscroll_hold_threshold -
(sid->w - x)) /
- _elm_config->thumbscroll_threshold;
+ _elm_config->thumbscroll_hold_threshold;
else
vx = 1.0;
}
- if (y < _elm_config->thumbscroll_threshold)
+ if (y < _elm_config->thumbscroll_hold_threshold)
{
- if (_elm_config->thumbscroll_threshold > 0.0)
- vy = -(double)(_elm_config->thumbscroll_threshold - y)
- / _elm_config->thumbscroll_threshold;
+ if (_elm_config->thumbscroll_hold_threshold > 0.0)
+ vy = -(double)(_elm_config->thumbscroll_hold_threshold - y)
+ / _elm_config->thumbscroll_hold_threshold;
else
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)
- vy = (double)(_elm_config->thumbscroll_threshold -
+ if (_elm_config->thumbscroll_hold_threshold > 0.0)
+ vy = (double)(_elm_config->thumbscroll_hold_threshold -
(sid->h - y)) /
- _elm_config->thumbscroll_threshold;
+ _elm_config->thumbscroll_hold_threshold;
else
vy = 1.0;
}
unsigned char vsync;
unsigned char thumbscroll_enable;
int thumbscroll_threshold;
+ int thumbscroll_hold_threshold;
double thumbscroll_momentum_threshold;
double thumbscroll_friction;
double thumbscroll_bounce_friction;