jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=80e3c643d8693a12b5650222c9181e71819fb8ef

commit 80e3c643d8693a12b5650222c9181e71819fb8ef
Author: Wonki Kim <wonki_....@samsung.com>
Date:   Mon Feb 20 11:31:12 2017 +0900

    interface_scrollable: Improve gravity_set api to support pan changing
    
    Summary:
    When you set gravity 1 on scroller, scroller sticks to the bottom
    even content is changed.
    however, scroller don't work like above, if size of pan is changed.
    
    this commit uses pan_pos_max rather than w/h of content_info
    because pan_pos_max is related with both content_size and pan size.
    
    gravity_set will work properly even if both size of content and pan are
    changed simultaneously.
    
    Test Plan:
    1. Select 'scroll3' in the elementary_test
    2. Append enough items so that scroll bar appears (about 30 items)
    3. Go to the bottom and Set gravity 1.0
    4. Check that scroller sticks to the bottom once you append another item
       (it works)
    5. Check that scroller sticks to to bottom once you resize window(pan)
       (it doesn't work without this patch)
    
    Reviewers: eagleeye, jpeg, cedric, woohyun, z-wony, herdsman
    
    Differential Revision: https://phab.enlightenment.org/D4665
---
 src/lib/elementary/elm_interface_scrollable.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/lib/elementary/elm_interface_scrollable.c 
b/src/lib/elementary/elm_interface_scrollable.c
index a9f79d2..e931279 100644
--- a/src/lib/elementary/elm_interface_scrollable.c
+++ b/src/lib/elementary/elm_interface_scrollable.c
@@ -1844,6 +1844,7 @@ static void
 _elm_scroll_wanted_region_set(Evas_Object *obj)
 {
    Evas_Coord ww, wh, wx;
+   Evas_Coord mx = 0, my = 0;
 
    ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(obj, sid);
 
@@ -1872,11 +1873,13 @@ _elm_scroll_wanted_region_set(Evas_Object *obj)
         wh = sid->wh;
      }
 
-   wx += (sid->content_info.w - sid->prev_cw) * sid->gravity_x;
-   sid->wy += (sid->content_info.h - sid->prev_ch) * sid->gravity_y;
+   elm_obj_pan_pos_max_get(sid->pan_obj, &mx, &my);
+
+   wx += (mx - sid->prev_cw) * sid->gravity_x;
+   sid->wy += (my - sid->prev_ch) * sid->gravity_y;
 
-   sid->prev_cw = sid->content_info.w;
-   sid->prev_ch = sid->content_info.h;
+   sid->prev_cw = mx;
+   sid->prev_ch = my;
 
    elm_interface_scrollable_content_region_set(obj, wx, sid->wy, ww, wh);
 }
@@ -4441,8 +4444,7 @@ _elm_interface_scrollable_gravity_set(Eo *obj 
EINA_UNUSED, Elm_Scrollable_Smart_
 {
    sid->gravity_x = x;
    sid->gravity_y = y;
-   sid->prev_cw = sid->content_info.w;
-   sid->prev_ch = sid->content_info.h;
+   elm_obj_pan_pos_max_get(sid->pan_obj, &sid->prev_cw, &sid->prev_ch);
 }
 
 EOLIAN static void

-- 


Reply via email to