scroller: fix a focus logic to move next/prior.
authorWonki Kim <wonki_.kim@samsung.com>
Mon, 30 Mar 2020 09:38:24 +0000 (18:38 +0900)
committerJongmin Lee <jm105.lee@samsung.com>
Mon, 30 Mar 2020 20:55:28 +0000 (05:55 +0900)
efl_ui_scrollable interface doesn't have a getter related with page number
this patch fixes a focus logic to move next/prior by pan size.

Change-Id: I0ad41886a1157e00a460c85705571de164b4510b

src/lib/elementary/efl_ui_scroller.c

index c67b6f159cac3e7e3f057aa76268bc777aaf120e..ef850ba2805a772d445b26f49aeeab03061f77db 100644 (file)
@@ -51,7 +51,6 @@ _key_action_move(Evas_Object *obj, const char *params)
    Evas_Coord c_y = 0;
    Evas_Coord max_x = 0;
    Evas_Coord max_y = 0;
-   Evas_Coord page_y = 0;
    Evas_Object *current_focus = NULL;
    Eina_List *can_focus_list = NULL;
    Evas_Object *new_focus = NULL;
@@ -63,7 +62,6 @@ _key_action_move(Evas_Object *obj, const char *params)
 
 
    p = efl_ui_scrollable_content_pos_get(obj);
-   page_y = -50;
    step = efl_ui_scrollable_step_size_get(obj);
    v = efl_ui_scrollable_viewport_geometry_get(obj);
    evas_object_geometry_get(sd->content, &c_x, &c_y, &max_x, &max_y);
@@ -173,17 +171,14 @@ _key_action_move(Evas_Object *obj, const char *params)
      }
    else if (!strcmp(dir, "prior"))
      {
-        if (page_y < 0)
-          p.y -= -(page_y * v.h) / 100;
-        else
-          p.y -= page_y;
+        p.y = p.y - v.h;
+        if (p.y < 0) p.y = 0;
      }
    else if (!strcmp(dir, "next"))
      {
-        if (page_y < 0)
-          p.y += -(page_y * v.h) / 100;
-        else
-          p.y += page_y;
+        p.y = p.y + v.h;
+        if (p.y + v.h > max_y)
+          p.y = max_y - v.h;
      }
    else return EINA_FALSE;