elm_interface_scrollable: fix wrong mirrored calculation
authorSangHyeon Lee <dltkdgus1764@gmail.com>
Thu, 25 Jun 2015 14:44:41 +0000 (16:44 +0200)
committerCedric BAIL <cedric@osg.samsung.com>
Thu, 25 Jun 2015 15:24:08 +0000 (17:24 +0200)
Summary:
This Patch is regarding D2553, but funtionally independent patch.
D2557 is also related with this patch, so to test working fine,
need to install those all three patches.

1. _elm_interface_scrollable_content_region_show store wx
   into scroll_interface_data without coverting mirrored_x.
   fix to store wx to mirror-converted x if is_mirrored.

2. _elm_scroll_x_mirrored_get return mirroed_x after compare zero not minx.
   so current mirrored_x couldn't be less then 0.
   fix to check min not 0 for set return value.

3.  _elm_scroll_x_mirrored_get calculation need to consider start position of scroller.
some scroller(e.g. gengrid) start from non-zero position, so calculation need to change
like below.
ret = (cw - (x + w - min));

@fix

Test Plan: You can test this after merge D2553 patch and D2557 and test gengrid2.

Reviewers: raster, Hermet, seoz, jaehwan, tanwar.umesh07, cedric

Subscribers: tanwar.umesh07, Jaehyun, anand.km, eagleeye, singh.amitesh

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/lib/elm_interface_scrollable.c

index bf598db..4adebcd 100644 (file)
@@ -1197,18 +1197,19 @@ static Evas_Coord
 _elm_scroll_x_mirrored_get(const Evas_Object *obj,
                            Evas_Coord x)
 {
-   Evas_Coord cw = 0, ch = 0, w = 0, ret;
+   Evas_Coord cw = 0, w = 0, min = 0, ret;
 
    ELM_SCROLL_IFACE_DATA_GET_OR_RETURN_VAL(obj, sid, x);
 
    if (!sid->pan_obj) return 0;
 
+   eo_do(sid->pan_obj, elm_obj_pan_pos_min_get(&min, NULL));
    eo_do((Eo *)obj, elm_interface_scrollable_content_viewport_geometry_get
          (NULL, NULL, &w, NULL));
-   eo_do(sid->pan_obj, elm_obj_pan_content_size_get(&cw, &ch));
-   ret = (cw - (x + w));
+   eo_do(sid->pan_obj, elm_obj_pan_content_size_get(&cw, NULL));
+   ret = cw - w - x + min + min;
 
-   return (ret >= 0) ? ret : 0;
+   return (ret >= min) ? ret : min;
 }
 
 /* Update the wanted coordinates according to the x, y passed
@@ -1808,7 +1809,7 @@ _elm_interface_scrollable_content_region_set(Eo *obj, Elm_Scrollable_Smart_Inter
 EOLIAN static void
 _elm_interface_scrollable_content_region_show(Eo *obj, Elm_Scrollable_Smart_Interface_Data *sid, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
 {
-   sid->wx = x;
+   sid->wx = (sid->is_mirrored ? _elm_scroll_x_mirrored_get(sid->obj, x) : x);
    sid->wy = y;
    sid->ww = w;
    sid->wh = h;
@@ -4303,7 +4304,7 @@ _elm_interface_scrollable_page_show(Eo *obj, Elm_Scrollable_Smart_Interface_Data
    if (pagenumber_h >= 0) x = sid->pagesize_h * pagenumber_h;
    if (pagenumber_v >= 0) y = sid->pagesize_v * pagenumber_v;
 
-   sid->wx = x;
+   sid->wx = (sid->is_mirrored ? _elm_scroll_x_mirrored_get(sid->obj, x) : x);
    sid->wy = y;
    sid->ww = w;
    sid->wh = h;