From 136fcddbd5d7495923d4d56664ebb44b32c7c5d8 Mon Sep 17 00:00:00 2001 From: Aharon Hillel Date: Wed, 21 Dec 2011 08:47:53 +0000 Subject: [PATCH] Elm Glayer: Fixed Momentum gesture compuation Signed-off-by: Aharon Hillel SVN revision: 66423 --- src/lib/elm_gesture_layer.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/lib/elm_gesture_layer.c b/src/lib/elm_gesture_layer.c index f3215dc..7f1ac54 100644 --- a/src/lib/elm_gesture_layer.c +++ b/src/lib/elm_gesture_layer.c @@ -1692,12 +1692,13 @@ get_vector(Evas_Coord x1, Evas_Coord y1, Evas_Coord x2, Evas_Coord y2, static int _get_direction(Evas_Coord x1, Evas_Coord x2) { - if (x1 == x2) - return 0; - else if (x2 < x1) + if (x2 < x1) return -1; - else + + if (x2 > x1) return 1; + + return 0; } /** * @internal @@ -1813,16 +1814,16 @@ _momentum_test(Evas_Object *obj, Pointer_Event *pe, else { int xdir, ydir; - xdir = _get_direction(st->line_st.x, pe_local.x); - ydir = _get_direction(st->line_st.y, pe_local.y); - if (!xdir || (xdir == (-st->xdir))) + xdir = _get_direction(st->line_end.x, pe_local.x); + ydir = _get_direction(st->line_end.y, pe_local.y); + if (xdir != st->xdir) { st->line_st.x = st->line_end.x; st->info.tx = st->t_st_x = st->t_end; st->xdir = xdir; } - if (!ydir || (ydir == (-st->ydir))) + if (ydir != st->ydir) { st->line_st.y = st->line_end.y; st->info.ty = st->t_st_y = st->t_end; -- 2.7.4