elementary gengrid: fix for working item reorder mode correctly 25/117025/2
authorMinkyu Kang <mk7.kang@samsung.com>
Tue, 21 Feb 2017 09:32:30 +0000 (15:02 +0530)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 7 Mar 2017 01:09:00 +0000 (17:09 -0800)
Summary:
Change the item indexing to start 1 after reordering animation.
Change the logic of edge checking to get the row or col correctly.

Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Test Plan:
elementary_test -to gengrid2
append 6 items
enable the reorder mode
check reordering is working properly (4 to 1)

@fix

Reviewers: singh.amitesh, cedric

Subscribers: jehun.lim, jpeg

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

Change-Id: If3e48d96127bb13dca8595bfc1b8bf6d8c303b08

src/lib/elm_gengrid.c

index 110f6cd..c95ee34 100644 (file)
@@ -2889,25 +2889,22 @@ _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)
           {
              row = cvh / sd->item_height;
              if (row <= 0) row = 1;
-             col = tmp->position / row;
-             x = tmp->position % row;
-             if (col == 0 || (col == 1 && x == 0))
+             col = (tmp->position - 1) / row;
+             if (col == 0)
                return EINA_TRUE;
           }
         else if (sd->item_width > 0)
           {
              col = cvw / sd->item_width;
              if (col <= 0) col = 1;
-             row = tmp->position / col;
-             x = tmp->position % col;
-             if (row == 0 || (row == 1 && x == 0))
+             row = (tmp->position - 1) / col;
+             if (row == 0)
                return EINA_TRUE;
           }
      }
@@ -3144,7 +3141,7 @@ _anim_end(Elm_Gengrid_Data *sd)
                                                      EINA_INLIST_GET(sd->reorder.it2));
           }
      }
-   _item_position_update(sd->items, 0);
+   _item_position_update(sd->items, 1);
 
    //TIZEN_ONLY(20160511) : Remove job for fixing calculate timing issue.
    sd->calc_done = EINA_FALSE;