Scroller: Improvement in _key_action_move() calculations.
authorUmesh Tanwar <umesh.tanwar@samsung.com>
Sun, 19 Jul 2015 14:40:28 +0000 (23:40 +0900)
committerSangHyeon Lee <dltkdgus1764@gmail.com>
Sun, 19 Jul 2015 14:40:50 +0000 (23:40 +0900)
Summary:
If x coordinate is equal to 0, key action is no more
effective as EINA_FALSE is returned. This is creating problem
in looping. Looping will be done when x < 0, but as soon as
x == 0, _key_action_move starts returning EINA_FALSE. Same
thing applies to y coordinate and other extremities.

@fix

Signed-off-by: Umesh Tanwar <umesh.tanwar@samsung.com>
Test Plan: elementary_test -> Scroller -> Loop in X axis -> scroll left using left key(looping does not happen)

Reviewers: raster, Hermet, cedric, singh.amitesh, SanghyeonLee

Reviewed By: SanghyeonLee

Subscribers: sachin.dev, SanghyeonLee, eagleeye

Differential Revision: https://phab.enlightenment.org/D2778

src/lib/elm_scroller.c

index 98f103b..31b9191 100644 (file)
@@ -189,22 +189,22 @@ _key_action_move(Evas_Object *obj, const char *params)
      }
    if (!strcmp(dir, "left"))
      {
-        if (x <= 0) return EINA_FALSE;
+        if ((x <= 0) && (!sd->loop_h)) return EINA_FALSE;
         x -= step_x;
      }
    else if (!strcmp(dir, "right"))
      {
-        if (x >= (max_x - v_w)) return EINA_FALSE;
+        if ((x >= (max_x - v_w)) && (!sd->loop_h)) return EINA_FALSE;
         x += step_x;
      }
    else if (!strcmp(dir, "up"))
      {
-        if (y == 0) return EINA_FALSE;
+        if ((y <= 0) && (!sd->loop_v)) return EINA_FALSE;
         y -= step_y;
      }
    else if (!strcmp(dir, "down"))
      {
-        if (y >= (max_y - v_h)) return EINA_FALSE;
+        if ((y >= (max_y - v_h)) && (!sd->loop_v)) return EINA_FALSE;
         y += step_y;
      }
    else if (!strcmp(dir, "first"))