elementary: gengrid - check the edge correctly
authorMinkyu Kang <mk7.kang@samsung.com>
Tue, 25 Oct 2016 21:12:42 +0000 (14:12 -0700)
committerCedric Bail <cedric@osg.samsung.com>
Tue, 25 Oct 2016 21:37:11 +0000 (14:37 -0700)
Summary:
The routine of checking edge of left side, divide position by row.
Since the result of fisrt item of last line is 1, that item was not checked as edge.
This patch is for fixing it.

Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Test Plan:
elementary_test -to gengrid2
append items (about 6)
horizontal mode on and item loop enable
check item loop is working properly

Reviewers: cedric, jpeg, Hermet, SanghyeonLee

Subscribers: jehun.lim, SanghyeonLee, cedric, jpeg

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

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
src/lib/elementary/elm_gengrid.c

index 717b306..768d6b2 100644 (file)
@@ -2771,6 +2771,7 @@ _elm_gengrid_item_edge_check(Elm_Object_Item *eo_it,
             ((sd->horizontal) && (dir == ELM_FOCUS_LEFT)))
      {
         Evas_Coord col, row, cvw, cvh;
+        int x;
 
         evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh);
         if (sd->horizontal && sd->item_height > 0)
@@ -2778,7 +2779,8 @@ _elm_gengrid_item_edge_check(Elm_Object_Item *eo_it,
              row = cvh / sd->item_height;
              if (row <= 0) row = 1;
              col = tmp->position / row;
-             if (col == 0)
+             x = tmp->position % row;
+             if (col == 0 || (col == 1 && x == 0))
                return EINA_TRUE;
           }
         else if (sd->item_width > 0)
@@ -2786,7 +2788,8 @@ _elm_gengrid_item_edge_check(Elm_Object_Item *eo_it,
              col = cvw / sd->item_width;
              if (col <= 0) col = 1;
              row = tmp->position / col;
-             if (row == 0)
+             x = tmp->position % col;
+             if (row == 0 || (row == 1 && x == 0))
                return EINA_TRUE;
           }
      }