forked from enlightenment/efl
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
This commit is contained in:
parent
75908799dc
commit
80e3c643d8
|
@ -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);
|
||||
|
||||
sid->prev_cw = sid->content_info.w;
|
||||
sid->prev_ch = sid->content_info.h;
|
||||
wx += (mx - sid->prev_cw) * sid->gravity_x;
|
||||
sid->wy += (my - sid->prev_ch) * sid->gravity_y;
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue