From 26a9e6cec20629b07437689e120d04092a7d154f Mon Sep 17 00:00:00 2001 From: SangHyeon Lee Date: Thu, 28 May 2015 23:07:27 +0900 Subject: [PATCH] Gengrid: fix mirroring bug in gengrid widget. Summary: Below bugs are exist in gengrid widget when use horizontal mode and mirrored set. 1. Gengrid item is placed wrong position when mirrored set. Current calulation for mirroring in _item_place only consider pan object positions. if widget is mirrored, item should be placed opposited position so object x position must be consider in mirroring calculation also. 2. Gengrid scroll(pan) minimum size is returned wrong value when mirroed set. As the result of 1's calculation present oposite position of items, so align also reversed when mirrored. but current gengrid didn't change align x so minimum size is return wrong value and scroller expanded wrong direction. @fix Test Plan: 1. run elementary_test and set mirroring On 2. run Gengrid2 in elementary_test 3. see how items are placed by push append button repeatly. 4. see scroller shows correct position and items. 5. change usr/bin/test_gengrid.c to set another align value on gengrid and test again. Reviewers: raster, seoz, Hermet, jaehwan Subscribers: Jaehyun, anand.km, eagleeye, singh.amitesh Differential Revision: https://phab.enlightenment.org/D2553 --- legacy/elementary/src/lib/elm_gengrid.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/legacy/elementary/src/lib/elm_gengrid.c b/legacy/elementary/src/lib/elm_gengrid.c index 5089f21725..3e4335671b 100644 --- a/legacy/elementary/src/lib/elm_gengrid.c +++ b/legacy/elementary/src/lib/elm_gengrid.c @@ -1252,7 +1252,7 @@ _item_place(Elm_Gen_Item *it, * mode */ { evas_object_geometry_get(WIDGET(it), NULL, NULL, &ww, NULL); - x = ww - x - wsd->item_width - wsd->pan_x - wsd->pan_x; + x = ww - x - wsd->item_width - wsd->pan_x - wsd->pan_x + ox + ox; } iw = wsd->item_width; ih = wsd->item_height; @@ -1590,10 +1590,11 @@ EOLIAN static void _elm_gengrid_pan_elm_pan_pos_min_get(Eo *obj, Elm_Gengrid_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y) { Evas_Coord mx = 0, my = 0; + Eina_Bool mirrored = elm_widget_mirrored_get(psd->wsd->obj); eo_do(obj, elm_obj_pan_pos_max_get(&mx, &my)); if (x) - *x = -mx * psd->wsd->align_x; + *x = -mx * (mirrored ? 1 - psd->wsd->align_x : psd->wsd->align_x); if (y) *y = -my * psd->wsd->align_y; }