forgot to make window of smoothing configurable. fix minor macro

oopsie too.



SVN revision: 60165
This commit is contained in:
Carsten Haitzler 2011-06-10 05:07:21 +00:00
parent 0a3572bc23
commit b01978ac93
6 changed files with 16 additions and 9 deletions

View File

@ -14,7 +14,8 @@ group "Elm_Config" struct {
value "thumbscroll_border_friction" double: 0.5;
value "scroll_smooth_amount" double: 1.0;
value "scroll_smooth_history_weight" double: 0.3;
value "scroll_smooth_future_time" double: 0.033;
value "scroll_smooth_future_time" double: 0.0;
value "scroll_smooth_time_window" double: 0.15;
value "scale" double: 1.0;
value "bgpixmap" int: 0;
value "compositing" int: 1;

View File

@ -14,7 +14,8 @@ group "Elm_Config" struct {
value "thumbscroll_border_friction" double: 0.5;
value "scroll_smooth_amount" double: 0.0;
value "scroll_smooth_history_weight" double: 0.3;
value "scroll_smooth_future_time" double: 0.033;
value "scroll_smooth_future_time" double: 0.0;
value "scroll_smooth_time_window" double: 0.15;
value "scale" double: 1.0;
value "bgpixmap" int: 0;
value "compositing" int: 1;

View File

@ -454,9 +454,6 @@ elm_main(int argc, char **argv)
elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
printf("my prefix: %s\n", elm_app_prefix_dir_get());
printf("elm test data in %s\n", elm_app_data_dir_get());
/* if called with a single argument try to autorun a test with
* the same name as the given param
* ex: elementary_test "Box Vert 2" */

View File

@ -571,6 +571,7 @@ _desc_init(void)
ELM_CONFIG_VAL(D, T, scroll_smooth_amount, T_DOUBLE);
ELM_CONFIG_VAL(D, T, scroll_smooth_history_weight, T_DOUBLE);
ELM_CONFIG_VAL(D, T, scroll_smooth_future_time, T_DOUBLE);
ELM_CONFIG_VAL(D, T, scroll_smooth_time_window, T_DOUBLE);
ELM_CONFIG_VAL(D, T, scale, T_DOUBLE);
ELM_CONFIG_VAL(D, T, bgpixmap, T_INT);
ELM_CONFIG_VAL(D, T, compositing, T_INT);
@ -1124,6 +1125,7 @@ _config_load(void)
_elm_config->scroll_smooth_amount = 1.0;
_elm_config->scroll_smooth_history_weight = 0.3;
_elm_config->scroll_smooth_future_time = 2.0 / 60.0;
_elm_config->scroll_smooth_time_window = 0.12;
_elm_config->scale = 1.0;
_elm_config->bgpixmap = 0;
_elm_config->compositing = 1;
@ -1481,6 +1483,8 @@ _env_get(void)
if (s) _elm_config->scroll_smooth_history_weight = atof(s);
s = getenv("ELM_SCROLL_SMOOTH_FUTURE_TIME");
if (s) _elm_config->scroll_smooth_future_time = atof(s);
s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW");
if (s) _elm_config->scroll_smooth_time_window = atof(s);
s = getenv("ELM_THEME");
if (s) eina_stringshare_replace(&_elm_config->theme, s);

View File

@ -99,6 +99,7 @@ struct _Elm_Config
double scroll_smooth_amount;
double scroll_smooth_history_weight;
double scroll_smooth_future_time;
double scroll_smooth_time_window;
double scale;
int bgpixmap;
int compositing;

View File

@ -1595,6 +1595,9 @@ _smart_event_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSE
{
sd->down.hist.est_timestamp_diff =
ecore_loop_time_get() - ((double)ev->timestamp / 1000.0);
sd->down.hist.tadd = 0.0;
sd->down.hist.dxsum = 0.0;
sd->down.hist.dysum = 0.0;
sd->down.now = 1;
sd->down.dragged = 0;
sd->down.dir_x = 0;
@ -1688,7 +1691,7 @@ _smart_hold_animator(void *data)
// oldest point is sd->down.history[i]
// newset is sd->down.history[0]
dt = t - sd->down.history[i].timestamp;
if (dt > 0.1)
if (dt > _elm_config->scroll_smooth_time_window)
{
i--;
break;
@ -1732,7 +1735,7 @@ _smart_hold_animator(void *data)
ysum /= (double)i;
tadd = tnow - sd->down.history[0].timestamp + _elm_config->scroll_smooth_future_time;
tadd = tadd - (maxdt / 2);
#define WEIGHT(n, o, v) n = (o * (v - 1.0)) + (n * v)
#define WEIGHT(n, o, v) n = (((double)o * (1.0 - v)) + ((double)n * v))
WEIGHT(tadd, sd->down.hist.tadd, _elm_config->scroll_smooth_history_weight);
WEIGHT(dxsum, sd->down.hist.dxsum, _elm_config->scroll_smooth_history_weight);
WEIGHT(dysum, sd->down.hist.dysum, _elm_config->scroll_smooth_history_weight);
@ -1741,8 +1744,8 @@ _smart_hold_animator(void *data)
sd->down.hist.tadd = tadd;
sd->down.hist.dxsum = dxsum;
sd->down.hist.dysum = dysum;
fx = WEIGHT(fx, sd->down.hold_x, _elm_config->scroll_smooth_amount);
fy = WEIGHT(fy, sd->down.hold_y, _elm_config->scroll_smooth_amount);
WEIGHT(fx, sd->down.hold_x, _elm_config->scroll_smooth_amount);
WEIGHT(fy, sd->down.hold_y, _elm_config->scroll_smooth_amount);
}
}