From 3d3d488d893106d16e690c09c881290148bce50e Mon Sep 17 00:00:00 2001 From: raster Date: Wed, 26 Oct 2011 06:30:07 +0000 Subject: [PATCH] From: Jaehwan Kim At first, try to execute elementary_test and drag down the list for bounce. Then as soon as release the mouse, click the list continuously and fast. The list will not be clicked because it cannot be clicked during the bounce animation. The bounce animation time is fixed and it is reset again, when the mouse is down and up. In the result, if we click it continuously, we can not choose the list item. (During animation, list can not be clicked). I changed the function "_smart_bounce_x_animator" and "_smart_bounce_ y_animator". I fixed the bounce time will be changed by remaining distance. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@64407 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/els_scroller.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/lib/els_scroller.c b/src/lib/els_scroller.c index a769eba..adba33a 100644 --- a/src/lib/els_scroller.c +++ b/src/lib/els_scroller.c @@ -678,8 +678,8 @@ static Eina_Bool _smart_bounce_x_animator(void *data) { Smart_Data *sd; - Evas_Coord x, y, dx; - double t, p, dt; + Evas_Coord x, y, dx, w, odx; + double t, p, dt, pd; sd = data; t = ecore_loop_time_get(); @@ -687,11 +687,19 @@ _smart_bounce_x_animator(void *data) if (dt >= 0.0) { dt = dt / _elm_config->thumbscroll_bounce_friction; + odx = sd->down.b2x - sd->down.bx; + elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, NULL); + if (!sd->down.momentum_animator && (w > abs(odx))) + { + pd = (double)odx / (double)w; + pd = (pd > 0) ? pd : -pd; + pd = 1.0 - ((1.0 - pd) * (1.0 - pd)); + dt = dt / pd; + } if (dt > 1.0) dt = 1.0; p = 1.0 - ((1.0 - dt) * (1.0 - dt)); elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); - dx = sd->down.b2x - sd->down.bx; - dx = (dx * p); + dx = (odx * p); x = sd->down.bx + dx; if (!sd->down.cancelled) elm_smart_scroller_child_pos_set(sd->smart_obj, x, y); @@ -718,8 +726,8 @@ static Eina_Bool _smart_bounce_y_animator(void *data) { Smart_Data *sd; - Evas_Coord x, y, dy; - double t, p, dt; + Evas_Coord x, y, dy, h, ody; + double t, p, dt, pd; sd = data; t = ecore_loop_time_get(); @@ -727,11 +735,19 @@ _smart_bounce_y_animator(void *data) if (dt >= 0.0) { dt = dt / _elm_config->thumbscroll_bounce_friction; + ody = sd->down.b2y - sd->down.by; + elm_smart_scroller_child_viewport_size_get(sd->smart_obj, NULL, &h); + if (!sd->down.momentum_animator && (h > abs(ody))) + { + pd = (double)ody / (double)h; + pd = (pd > 0) ? pd : -pd; + pd = 1.0 - ((1.0 - pd) * (1.0 - pd)); + dt = dt / pd; + } if (dt > 1.0) dt = 1.0; p = 1.0 - ((1.0 - dt) * (1.0 - dt)); elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); - dy = sd->down.b2y - sd->down.by; - dy = (dy * p); + dy = (ody * p); y = sd->down.by + dy; if (!sd->down.cancelled) elm_smart_scroller_child_pos_set(sd->smart_obj, x, y); -- 2.7.4