summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHosang Kim <hosang12.kim@samsung.com>2014-01-14 16:56:52 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-01-14 16:59:08 +0900
commita1ea515dc01463d19491574688502c580c2b447a (patch)
treee80d12018efd90c7332b0941a1d7f99e54176bf0
parent0f498af8884fc1dae7fa0940dd375038abff057e (diff)
scroller: Fixed wheel event callback
Summary: scroller is moved page by page if scroller's paging is enable 1. default is move to vertical. 2. move to horizontal with Shift key Reviewers: seoz, Hermet, jaehwan, woohyun, raster, cedric Reviewed By: seoz Differential Revision: https://phab.enlightenment.org/D453
-rw-r--r--src/lib/elm_interface_scrollable.c67
1 files changed, 51 insertions, 16 deletions
diff --git a/src/lib/elm_interface_scrollable.c b/src/lib/elm_interface_scrollable.c
index 9d31eb4d1..4dd77899e 100644
--- a/src/lib/elm_interface_scrollable.c
+++ b/src/lib/elm_interface_scrollable.c
@@ -39,7 +39,14 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
39}; 39};
40 40
41static void _elm_pan_content_set(Evas_Object *, Evas_Object *); 41static void _elm_pan_content_set(Evas_Object *, Evas_Object *);
42 42static void
43_elm_scroll_scroll_to_x(Elm_Scrollable_Smart_Interface_Data *sid,
44 double t_in,
45 Evas_Coord pos_x);
46static void
47_elm_scroll_scroll_to_y(Elm_Scrollable_Smart_Interface_Data *sid,
48 double t_in,
49 Evas_Coord pos_y);
43static double 50static double
44_round(double value, int pos) 51_round(double value, int pos)
45{ 52{
@@ -1925,6 +1932,7 @@ _elm_scroll_wheel_event_cb(void *data,
1925 Evas_Event_Mouse_Wheel *ev; 1932 Evas_Event_Mouse_Wheel *ev;
1926 Evas_Coord x = 0, y = 0, vw = 0, vh = 0, cw = 0, ch = 0; 1933 Evas_Coord x = 0, y = 0, vw = 0, vh = 0, cw = 0, ch = 0;
1927 int direction = 0; 1934 int direction = 0;
1935 int pagenumber_h = 0, pagenumber_v = 0;
1928 1936
1929 sid = data; 1937 sid = data;
1930 ev = event_info; 1938 ev = event_info;
@@ -1967,25 +1975,52 @@ _elm_scroll_wheel_event_cb(void *data,
1967 eo_do(sid->obj, elm_scrollable_interface_content_viewport_size_get(&vw, &vh)); 1975 eo_do(sid->obj, elm_scrollable_interface_content_viewport_size_get(&vw, &vh));
1968 if (sid->pan_obj) 1976 if (sid->pan_obj)
1969 eo_do(sid->pan_obj, elm_obj_pan_content_size_get(&cw, &ch)); 1977 eo_do(sid->pan_obj, elm_obj_pan_content_size_get(&cw, &ch));
1970 if (!direction) 1978 if (!_paging_is_enabled(sid))
1971 { 1979 {
1972 if (ch > vh || cw <= vw) 1980 if (!direction)
1973 y += ev->z * sid->step.y; 1981 {
1974 else 1982 if (ch > vh || cw <= vw)
1975 x += ev->z * sid->step.x; 1983 y += ev->z * sid->step.y;
1984 else
1985 x += ev->z * sid->step.x;
1986 }
1987 else if (direction == 1)
1988 {
1989 if (cw > vw || ch <= vh)
1990 x += ev->z * sid->step.x;
1991 else
1992 y += ev->z * sid->step.y;
1993 }
1994
1995 if ((!sid->hold) && (!sid->freeze))
1996 {
1997 _elm_scroll_wanted_coordinates_update(sid, x, y);
1998 eo_do(sid->obj, elm_scrollable_interface_content_pos_set(x, y, EINA_TRUE));
1999 }
1976 } 2000 }
1977 else if (direction == 1) 2001 else
1978 { 2002 {
1979 if (cw > vw || ch <= vh) 2003 eo_do(sid->obj, elm_scrollable_interface_current_page_get(&pagenumber_h, &pagenumber_v));
1980 x += ev->z * sid->step.x; 2004 if (!direction)
1981 else 2005 {
1982 y += ev->z * sid->step.y; 2006 if (ch > vh || cw <= vw)
1983 } 2007 y = (pagenumber_v + (1 * ev->z)) * sid->pagesize_v;
2008 else
2009 x = (pagenumber_h + (1 * ev->z)) * sid->pagesize_h;
2010 }
2011 else if (direction == 1)
2012 {
2013 if (cw > vw || ch <= vh)
2014 x = (pagenumber_h + (1 * ev->z)) * sid->pagesize_h;
2015 else
2016 y = (pagenumber_v + (1 * ev->z)) * sid->pagesize_v;
2017 }
1984 2018
1985 if ((!sid->hold) && (!sid->freeze)) 2019 if ((!sid->hold) && (!sid->freeze))
1986 { 2020 {
1987 _elm_scroll_wanted_coordinates_update(sid, x, y); 2021 _elm_scroll_scroll_to_x(sid, _elm_config->bring_in_scroll_friction, x);
1988 eo_do(sid->obj, elm_scrollable_interface_content_pos_set(x, y, EINA_TRUE)); 2022 _elm_scroll_scroll_to_y(sid, _elm_config->bring_in_scroll_friction, y);
2023 }
1989 } 2024 }
1990} 2025}
1991 2026