summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorWonki Kim <wonki_.kim@samsung.com>2017-02-20 11:31:12 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-02-20 11:38:02 +0900
commit80e3c643d8693a12b5650222c9181e71819fb8ef (patch)
treef98bf202124202f5955253b67d711ac1d7459925 /src/lib/elementary
parent75908799dc0e79bbee72be3b23d51cd6348d8467 (diff)
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
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/elm_interface_scrollable.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c
index a9f79d27bb..e9312796dc 100644
--- a/src/lib/elementary/elm_interface_scrollable.c
+++ b/src/lib/elementary/elm_interface_scrollable.c
@@ -1844,6 +1844,7 @@ static void
1844_elm_scroll_wanted_region_set(Evas_Object *obj) 1844_elm_scroll_wanted_region_set(Evas_Object *obj)
1845{ 1845{
1846 Evas_Coord ww, wh, wx; 1846 Evas_Coord ww, wh, wx;
1847 Evas_Coord mx = 0, my = 0;
1847 1848
1848 ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(obj, sid); 1849 ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(obj, sid);
1849 1850
@@ -1872,11 +1873,13 @@ _elm_scroll_wanted_region_set(Evas_Object *obj)
1872 wh = sid->wh; 1873 wh = sid->wh;
1873 } 1874 }
1874 1875
1875 wx += (sid->content_info.w - sid->prev_cw) * sid->gravity_x; 1876 elm_obj_pan_pos_max_get(sid->pan_obj, &mx, &my);
1876 sid->wy += (sid->content_info.h - sid->prev_ch) * sid->gravity_y; 1877
1878 wx += (mx - sid->prev_cw) * sid->gravity_x;
1879 sid->wy += (my - sid->prev_ch) * sid->gravity_y;
1877 1880
1878 sid->prev_cw = sid->content_info.w; 1881 sid->prev_cw = mx;
1879 sid->prev_ch = sid->content_info.h; 1882 sid->prev_ch = my;
1880 1883
1881 elm_interface_scrollable_content_region_set(obj, wx, sid->wy, ww, wh); 1884 elm_interface_scrollable_content_region_set(obj, wx, sid->wy, ww, wh);
1882} 1885}
@@ -4441,8 +4444,7 @@ _elm_interface_scrollable_gravity_set(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_
4441{ 4444{
4442 sid->gravity_x = x; 4445 sid->gravity_x = x;
4443 sid->gravity_y = y; 4446 sid->gravity_y = y;
4444 sid->prev_cw = sid->content_info.w; 4447 elm_obj_pan_pos_max_get(sid->pan_obj, &sid->prev_cw, &sid->prev_ch);
4445 sid->prev_ch = sid->content_info.h;
4446} 4448}
4447 4449
4448EOLIAN static void 4450EOLIAN static void