summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_scroll_manager.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/elementary/efl_ui_scroll_manager.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/lib/elementary/efl_ui_scroll_manager.c b/src/lib/elementary/efl_ui_scroll_manager.c
index 901d7c12a5..29df43b03c 100644
--- a/src/lib/elementary/efl_ui_scroll_manager.c
+++ b/src/lib/elementary/efl_ui_scroll_manager.c
@@ -1293,34 +1293,35 @@ _scroll_manager_hold_animator_del(Efl_Ui_Scroll_Manager_Data *sd)
1293 return EINA_FALSE; 1293 return EINA_FALSE;
1294} 1294}
1295 1295
1296static void _scroll_manager_momentum_animator_add(Efl_Ui_Scroll_Manager_Data *sd, double vx, double vy) 1296static void
1297_scroll_manager_momentum_animator_add(Efl_Ui_Scroll_Manager_Data *sd, double vx, double vy)
1297{ 1298{
1298 static const double friction = 5000; 1299#define FRICTION 5000
1299 static const double inverse_mass = 1; 1300#define INVERSE_MASS 1
1300 static const double accel = friction * inverse_mass; 1301#define ACCEL (FRICTION * INVERSE_MASS)
1301 double dur = 0.0, vel = 0.0; 1302 double dur = 0.0;
1302 char sdx = 0, sdy = 0; 1303 char sdx = 0, sdy = 0;
1303 Evas_Coord dstx = 0, dsty = 0; 1304 Evas_Coord dstx = 0, dsty = 0;
1304 1305
1305/* 1306/*
1306 if (_scroll_manager_scrollto_animator_del(sd)) 1307 if (_scroll_manager_scrollto_animator_del(sd))
1307 { 1308 {
1308 restore current veolocity 1309 restore current veolocity
1309 add to vx/vy 1310 add to vx/vy
1310 } 1311 }
1311*/ 1312*/
1312 Eina_Position2D cur = efl_ui_pan_position_get(sd->pan_obj); 1313 Eina_Position2D cur = efl_ui_pan_position_get(sd->pan_obj);
1313 1314
1314 sdx = (vx > 0) - (vx < 0); 1315 sdx = (vx > 0) - (vx < 0);
1315 sdy = (vy > 0) - (vy < 0); 1316 sdy = (vy > 0) - (vy < 0);
1316 1317
1317 dstx = cur.x + sdx * (vx * vx) / (2 * accel); 1318 dstx = cur.x + ((sdx * vx * vx) / (double)(2 * ACCEL));
1318 dsty = cur.y + sdy * (vy * vy) / (2 * accel); 1319 dsty = cur.y + ((sdy * vy * vy) / (double)(2 * ACCEL));
1319 1320
1320 vel = sqrt(vx*vx + vy*vy); 1321 dur = sqrt((vx * vx) + (vy * vy)) / (double)ACCEL;
1321 dur = vel / accel;
1322 1322
1323 _scroll_manager_scrollto_animator_add(sd, cur.x, cur.y, dstx, dsty, dur, dur, INTERP_DECEL); 1323 _scroll_manager_scrollto_animator_add(sd, cur.x, cur.y, dstx, dsty,
1324 dur, dur, INTERP_DECEL);
1324} 1325}
1325 1326
1326static void 1327static void