interface_scrollable: Unify basis of calculation of page_get logic

Summary:
If rtl mode is set, current_page_get api should return reversed page number.
To do that, make x position x-axis reversed before page calculating.

Also bring_in and page_show should show the reversed page in rtl mode.
This patch modify the functions to support that.

Lastly, scroller should be scrolling based on the right edge of the page.

This patch is a combination of the patches(D4559,D4560)

Test Plan:
1. Run scroller test on elementary_test
2. Turn ui mirrored mode on
3. Manipulate scroller in various ways
    - It should scroll proper position when you click next or prev btn.

Reviewers: woohyun, taxi2se, z-wony, cedric

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4558
This commit is contained in:
Wonki Kim 2017-01-16 14:20:04 +09:00 committed by Jean-Philippe Andre
parent 746ac26425
commit fbad285eca
1 changed files with 8 additions and 1 deletions

View File

@ -2203,6 +2203,7 @@ _elm_scroll_page_x_get(Elm_Scrollable_Smart_Interface_Data *sid,
x += (abs(offset) < dx ? offset : -(dx + 1));
}
if (sid->is_mirrored) x += w;
if (sid->pagesize_h > 0)
{
if (x >= 0)
@ -2212,6 +2213,7 @@ _elm_scroll_page_x_get(Elm_Scrollable_Smart_Interface_Data *sid,
x = x / (sid->pagesize_h);
x = x * (sid->pagesize_h);
}
if (sid->is_mirrored) x -= w;
if (!sid->loop_h)
{
if ((x + w) > cw) x = cw - w;
@ -4319,6 +4321,9 @@ _elm_interface_scrollable_current_page_get(Eo *obj EINA_UNUSED, Elm_Scrollable_S
elm_interface_scrollable_content_pos_get(sid->obj, &x, &y);
if (pagenumber_h)
{
if (sid->is_mirrored)
x = _elm_scroll_x_mirrored_get(sid->obj, x);
if (sid->pagesize_h > 0)
{
double result = (double)x / (double)sid->pagesize_h;
@ -4384,9 +4389,10 @@ _elm_interface_scrollable_page_show(Eo *obj, Elm_Scrollable_Smart_Interface_Data
elm_interface_scrollable_content_viewport_geometry_get
(sid->obj, NULL, NULL, &w, &h);
x = sid->pagesize_h * pagenumber_h;
x = (sid->is_mirrored ? _elm_scroll_x_mirrored_get(sid->obj, x) : x);
y = sid->pagesize_v * pagenumber_v;
sid->wx = (sid->is_mirrored ? _elm_scroll_x_mirrored_get(sid->obj, x) : x);
sid->wx = x;
sid->wy = y;
sid->ww = w;
sid->wh = h;
@ -4411,6 +4417,7 @@ _elm_interface_scrollable_page_bring_in(Eo *obj, Elm_Scrollable_Smart_Interface_
elm_interface_scrollable_content_viewport_geometry_get
(sid->obj, NULL, NULL, &w, &h);
x = sid->pagesize_h * pagenumber_h;
x = (sid->is_mirrored ? _elm_scroll_x_mirrored_get(sid->obj, x) : x);
y = sid->pagesize_v * pagenumber_v;
if (_elm_scroll_content_region_show_internal(obj, &x, &y, w, h))
{