summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-12-20 21:49:18 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-12-20 21:49:18 +0900
commit75bb46a41227c337001a8eee75ae25c5ac1d0e83 (patch)
tree9e1c678b8b270c87afb0d11e5b80ec692b6f36cc
parentb22b2ded1d72e63f7e3c3be425e973e6d8d3fb6c (diff)
elm - scroll manager - fix up momentum animator code to use real consts
use real constnants and remove useless vasriables as well as fix up formatting... so we don't get compilers complaining about non-const values etc. @fix
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