forked from enlightenment/efl
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
This commit is contained in:
parent
b22b2ded1d
commit
75bb46a412
|
@ -1293,12 +1293,13 @@ _scroll_manager_hold_animator_del(Efl_Ui_Scroll_Manager_Data *sd)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _scroll_manager_momentum_animator_add(Efl_Ui_Scroll_Manager_Data *sd, double vx, double vy)
|
static void
|
||||||
|
_scroll_manager_momentum_animator_add(Efl_Ui_Scroll_Manager_Data *sd, double vx, double vy)
|
||||||
{
|
{
|
||||||
static const double friction = 5000;
|
#define FRICTION 5000
|
||||||
static const double inverse_mass = 1;
|
#define INVERSE_MASS 1
|
||||||
static const double accel = friction * inverse_mass;
|
#define ACCEL (FRICTION * INVERSE_MASS)
|
||||||
double dur = 0.0, vel = 0.0;
|
double dur = 0.0;
|
||||||
char sdx = 0, sdy = 0;
|
char sdx = 0, sdy = 0;
|
||||||
Evas_Coord dstx = 0, dsty = 0;
|
Evas_Coord dstx = 0, dsty = 0;
|
||||||
|
|
||||||
|
@ -1314,13 +1315,13 @@ static void _scroll_manager_momentum_animator_add(Efl_Ui_Scroll_Manager_Data *sd
|
||||||
sdx = (vx > 0) - (vx < 0);
|
sdx = (vx > 0) - (vx < 0);
|
||||||
sdy = (vy > 0) - (vy < 0);
|
sdy = (vy > 0) - (vy < 0);
|
||||||
|
|
||||||
dstx = cur.x + sdx * (vx * vx) / (2 * accel);
|
dstx = cur.x + ((sdx * vx * vx) / (double)(2 * ACCEL));
|
||||||
dsty = cur.y + sdy * (vy * vy) / (2 * accel);
|
dsty = cur.y + ((sdy * vy * vy) / (double)(2 * ACCEL));
|
||||||
|
|
||||||
vel = sqrt(vx*vx + vy*vy);
|
dur = sqrt((vx * vx) + (vy * vy)) / (double)ACCEL;
|
||||||
dur = vel / accel;
|
|
||||||
|
|
||||||
_scroll_manager_scrollto_animator_add(sd, cur.x, cur.y, dstx, dsty, dur, dur, INTERP_DECEL);
|
_scroll_manager_scrollto_animator_add(sd, cur.x, cur.y, dstx, dsty,
|
||||||
|
dur, dur, INTERP_DECEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue