And add the configuration thumbscroll_flick_distance_tolerance. It's the max flick distance.
* added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
in toolar widget.
+
+2013-07-03 Jaehwan Kim
+
+ * Change the method to calculate a distance which be scrolled from linear to sine curve.
+ And add the configuration thumbscroll_flick_distance_tolerance. It's the max flick distance.
* Add elm_fileselector_mime_type_filter_append and elm_fileselector_filters_clear to support mime type filter.
* Add the elm_scrollable_interface_content_viewport_resize_cb_set.
* added callback call "scroll", "scroll,anim,start", "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop" in toolar widget.
+ * Add the configuration thumbscroll_flick_distance_tolerance.
Improvements:
* Support language change for widget items (Ctxpopup, Hoversel, Naviframe, Diskselector, List, Menu, Segment_Control, Toolbar, Popup, MultibuttonEntry)
* Move cursor when mouse moves with longpress.
* Show magnifier when selection handlers are pressed or moved.
+ * Change the method to calculate a distance which be scrolled from linear to sine curve.
Fixes:
* Now elm_datetime_field_limit_set() can set year limits wihtout problems.
value "thumbscroll_threshold" int: 24;
value "thumbscroll_hold_threshold" int: 24;
value "thumbscroll_momentum_threshold" double: 100.0;
+ value "thumbscroll_flick_distance_tolerance" int: 1000;
value "thumbscroll_friction" double: 1.0;
value "thumbscroll_min_friction" double: 1.0;
value "thumbscroll_friction_standard" double: 2000.0;
value "thumbscroll_threshold" int: 24;
value "thumbscroll_hold_threshold" int: 100;
value "thumbscroll_momentum_threshold" double: 100.0;
+ value "thumbscroll_flick_distance_tolerance" int: 1000;
value "thumbscroll_friction" double: 1.0;
value "thumbscroll_min_friction" double: 0.3;
value "thumbscroll_friction_standard" double: 3000.0;
value "thumbscroll_threshold" int: 4;
value "thumbscroll_hold_threshold" int: 4;
value "thumbscroll_momentum_threshold" double: 100.0;
+ value "thumbscroll_flick_distance_tolerance" int: 1000;
value "thumbscroll_friction" double: 1.0;
value "thumbscroll_min_friction" double: 1.0;
value "thumbscroll_friction_standard" double: 2000.0;
}
static void
+tsfdt_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
+tsfdt_change(void *data __UNUSED__,
+ Evas_Object *obj,
+ void *event_info __UNUSED__)
+{
+ double tsfdt = elm_config_scroll_thumbscroll_flick_distance_tolerance_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tsfdt == val) return;
+ elm_config_scroll_thumbscroll_flick_distance_tolerance_set(val);
+ elm_config_all_flush();
+}
+
+static void
tsf_round(void *data __UNUSED__,
Evas_Object *obj,
void *event_info __UNUSED__)
{
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_flick_distance_tolerance, ts_friction,
ts_min_friction, ts_friction_standard, ts_border_friction,
ts_sensitivity_friction, ts_acceleration_threshold,
ts_acceleration_time_limit, ts_acceleration_weight, page_friction,
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_flick_distance_tolerance = elm_config_scroll_thumbscroll_flick_distance_tolerance_get();
ts_friction = elm_config_scroll_thumbscroll_friction_get();
ts_min_friction = elm_config_scroll_thumbscroll_min_friction_get();
ts_friction_standard = elm_config_scroll_thumbscroll_friction_standard_get();
"ts_momentum_threshold_slider"),
ts_momentum_threshold);
elm_slider_value_set(evas_object_data_get(win,
+ "ts_flick_distance_tolerance_slider"),
+ ts_flick_distance_tolerance);
+ elm_slider_value_set(evas_object_data_get(win,
"ts_friction_slider"),
ts_friction);
elm_slider_value_set(evas_object_data_get(win,
evas_object_smart_callback_add(sl, "delay,changed", tsmt_change,
NULL);
+ LABEL_FRAME_ADD("<hilight>Thumb scroll flick distance tolerance</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the number of pixels the maximum<br/>"
+ "distance which can be flicked. If it is<br/>"
+ "flicked more than this, the flick distance<br/>"
+ "is same with maximum distance");
+ evas_object_data_set(win, "ts_flick_distance_tolerance_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, 100.0, 3000.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_flick_distance_tolerance_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tsfdt_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tsfdt_change, NULL);
+
LABEL_FRAME_ADD("<hilight>Thumb scroll friction</>");
sl = elm_slider_add(win);
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_flick_distance_tolerance, T_INT);
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->thumbscroll_threshold = 24;
_elm_config->thumbscroll_hold_threshold = 24;
_elm_config->thumbscroll_momentum_threshold = 100.0;
+ _elm_config->thumbscroll_flick_distance_tolerance = 1000;
_elm_config->thumbscroll_friction = 1.0;
_elm_config->thumbscroll_min_friction = 0.5;
_elm_config->thumbscroll_friction_standard = 1000.0;
// 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);
+ s = getenv("ELM_THUMBSCROLL_FLICK_DISTANCE_TOLERANCE");
+ if (s) _elm_config->thumbscroll_flick_distance_tolerance = atoi(s);
s = getenv("ELM_THUMBSCROLL_FRICTION");
if (s) _elm_config->thumbscroll_friction = _elm_atof(s);
s = getenv("ELM_THUMBSCROLL_MIN_FRICTION");
_elm_config->thumbscroll_momentum_threshold = threshold;
}
+EAPI unsigned int
+elm_config_scroll_thumbscroll_flick_distance_tolerance_get(void)
+{
+ return _elm_config->thumbscroll_flick_distance_tolerance;
+}
+
+EAPI void
+elm_config_scroll_thumbscroll_flick_distance_tolerance_set(unsigned int distance)
+{
+ _elm_config->thumbscroll_flick_distance_tolerance = distance;
+}
+
EAPI double
elm_config_scroll_thumbscroll_friction_get(void)
{
EAPI void elm_config_scroll_thumbscroll_momentum_threshold_set(double threshold);
/**
+ * Get the number of pixels the maximum distance which can be flicked.
+ * If it is flicked more than this,
+ * the flick distance is same with maximum distance.
+ *
+ * @return the thumb scroll maximum flick distance
+ *
+ * @ingroup Scrolling
+ */
+EAPI unsigned int elm_config_scroll_thumbscroll_flick_distance_tolerance_get(void);
+
+/**
+ * Set the number of pixels the maximum distance which can be flicked.
+ * If it is flicked more than this,
+ * the flick distance is same with maximum distance.
+ *
+ * @param distance the thumb scroll maximum flick distance
+ *
+ * @see elm_config_thumbscroll_flick_distance_tolerance_get()
+ * @ingroup Scrolling
+ */
+EAPI void elm_config_scroll_thumbscroll_flick_distance_tolerance_set(unsigned int distance);
+
+/**
* Get the amount of inertia a scroller will impose at self scrolling
* animations.
*
if ((_elm_config->thumbscroll_friction > 0.0) &&
(vel > _elm_config->thumbscroll_momentum_threshold))
{
+ Evas_Coord vw, vh, max_d;
int minx, miny, mx, my, px, py;
double tt = 0.0, dtt = 0.0;
eo_do(sid->pan_obj, elm_obj_pan_pos_max_get
(&mx, &my));
eo_do(sid->pan_obj, elm_obj_pan_pos_get(&px, &py));
- sid->down.dx = ((double)dx / at);
- sid->down.dy = ((double)dy / at);
+ eo_do(sid->obj,
+ elm_scrollable_interface_content_viewport_size_get(&vw, &vh));
+ max_d = _elm_config->thumbscroll_flick_distance_tolerance;
+ if (dx > 0)
+ sid->down.dx = (sin((M_PI * (double)dx / max_d)
+ - (M_PI / 2)) + 1) * max_d / at;
+ else
+ sid->down.dx = (sin((M_PI * (double)dx / max_d)
+ + (M_PI / 2)) - 1) * max_d / at;
+ if (dy > 0)
+ sid->down.dy = (sin((M_PI * (double)dy / max_d)
+ - (M_PI / 2)) + 1) * max_d / at;
+ else
+ sid->down.dy = (sin((M_PI * (double)dy / max_d)
+ + (M_PI / 2)) - 1) * max_d / at;
if (((sid->down.dx > 0) && (sid->down.pdx > 0)) ||
((sid->down.dx < 0) && (sid->down.pdx < 0)) ||
((sid->down.dy > 0) && (sid->down.pdy > 0)) ||
int thumbscroll_threshold;
int thumbscroll_hold_threshold;
double thumbscroll_momentum_threshold;
+ int thumbscroll_flick_distance_tolerance;
double thumbscroll_friction;
double thumbscroll_min_friction;
double thumbscroll_friction_standard;