summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWonki Kim <wonki_.kim@samsung.com>2017-01-16 14:20:04 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-01-16 14:20:04 +0900
commitfbad285eca8bde68de0158395b346bdac25dc3ec (patch)
treeeba1fa7c701dcdaa0c10f8addfc9e1c470181a16 /src
parent746ac264254705f9365e4aeed9afb80edf39f6e8 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/elm_interface_scrollable.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c
index 4c6c1694fd..a9f79d27bb 100644
--- a/src/lib/elementary/elm_interface_scrollable.c
+++ b/src/lib/elementary/elm_interface_scrollable.c
@@ -2203,6 +2203,7 @@ _elm_scroll_page_x_get(Elm_Scrollable_Smart_Interface_Data *sid,
2203 x += (abs(offset) < dx ? offset : -(dx + 1)); 2203 x += (abs(offset) < dx ? offset : -(dx + 1));
2204 } 2204 }
2205 2205
2206 if (sid->is_mirrored) x += w;
2206 if (sid->pagesize_h > 0) 2207 if (sid->pagesize_h > 0)
2207 { 2208 {
2208 if (x >= 0) 2209 if (x >= 0)
@@ -2212,6 +2213,7 @@ _elm_scroll_page_x_get(Elm_Scrollable_Smart_Interface_Data *sid,
2212 x = x / (sid->pagesize_h); 2213 x = x / (sid->pagesize_h);
2213 x = x * (sid->pagesize_h); 2214 x = x * (sid->pagesize_h);
2214 } 2215 }
2216 if (sid->is_mirrored) x -= w;
2215 if (!sid->loop_h) 2217 if (!sid->loop_h)
2216 { 2218 {
2217 if ((x + w) > cw) x = cw - w; 2219 if ((x + w) > cw) x = cw - w;
@@ -4319,6 +4321,9 @@ _elm_interface_scrollable_current_page_get(Eo *obj EINA_UNUSED, Elm_Scrollable_S
4319 elm_interface_scrollable_content_pos_get(sid->obj, &x, &y); 4321 elm_interface_scrollable_content_pos_get(sid->obj, &x, &y);
4320 if (pagenumber_h) 4322 if (pagenumber_h)
4321 { 4323 {
4324 if (sid->is_mirrored)
4325 x = _elm_scroll_x_mirrored_get(sid->obj, x);
4326
4322 if (sid->pagesize_h > 0) 4327 if (sid->pagesize_h > 0)
4323 { 4328 {
4324 double result = (double)x / (double)sid->pagesize_h; 4329 double result = (double)x / (double)sid->pagesize_h;
@@ -4384,9 +4389,10 @@ _elm_interface_scrollable_page_show(Eo *obj, Elm_Scrollable_Smart_Interface_Data
4384 elm_interface_scrollable_content_viewport_geometry_get 4389 elm_interface_scrollable_content_viewport_geometry_get
4385 (sid->obj, NULL, NULL, &w, &h); 4390 (sid->obj, NULL, NULL, &w, &h);
4386 x = sid->pagesize_h * pagenumber_h; 4391 x = sid->pagesize_h * pagenumber_h;
4392 x = (sid->is_mirrored ? _elm_scroll_x_mirrored_get(sid->obj, x) : x);
4387 y = sid->pagesize_v * pagenumber_v; 4393 y = sid->pagesize_v * pagenumber_v;
4388 4394
4389 sid->wx = (sid->is_mirrored ? _elm_scroll_x_mirrored_get(sid->obj, x) : x); 4395 sid->wx = x;
4390 sid->wy = y; 4396 sid->wy = y;
4391 sid->ww = w; 4397 sid->ww = w;
4392 sid->wh = h; 4398 sid->wh = h;
@@ -4411,6 +4417,7 @@ _elm_interface_scrollable_page_bring_in(Eo *obj, Elm_Scrollable_Smart_Interface_
4411 elm_interface_scrollable_content_viewport_geometry_get 4417 elm_interface_scrollable_content_viewport_geometry_get
4412 (sid->obj, NULL, NULL, &w, &h); 4418 (sid->obj, NULL, NULL, &w, &h);
4413 x = sid->pagesize_h * pagenumber_h; 4419 x = sid->pagesize_h * pagenumber_h;
4420 x = (sid->is_mirrored ? _elm_scroll_x_mirrored_get(sid->obj, x) : x);
4414 y = sid->pagesize_v * pagenumber_v; 4421 y = sid->pagesize_v * pagenumber_v;
4415 if (_elm_scroll_content_region_show_internal(obj, &x, &y, w, h)) 4422 if (_elm_scroll_content_region_show_internal(obj, &x, &y, w, h))
4416 { 4423 {