summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/elm_interface_scrollable.c57
-rw-r--r--src/lib/elementary/elm_interface_scrollable.h6
-rw-r--r--src/lib/elementary/elm_pan.eo10
3 files changed, 17 insertions, 56 deletions
diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c
index 819ba2bbf1..f43bc0a0db 100644
--- a/src/lib/elementary/elm_interface_scrollable.c
+++ b/src/lib/elementary/elm_interface_scrollable.c
@@ -82,25 +82,7 @@ _round(double value, int pos)
82static void 82static void
83_elm_pan_update(Elm_Pan_Smart_Data *psd) 83_elm_pan_update(Elm_Pan_Smart_Data *psd)
84{ 84{
85 if (!psd->gravity_x && !psd->gravity_y)
86 {
87 evas_object_move(psd->content, psd->x - psd->px, psd->y - psd->py);
88 return;
89 }
90
91 if ((!psd->px) && (!psd->py))
92 {
93 psd->px = psd->delta_posx * psd->gravity_x;
94 psd->py = psd->delta_posy * psd->gravity_y;
95 }
96 psd->delta_posx += psd->content_w - psd->prev_cw;
97 psd->prev_cw = psd->content_w;
98 psd->delta_posy += psd->content_h - psd->prev_ch;
99 psd->prev_ch = psd->content_h;
100
101 evas_object_move(psd->content, psd->x - psd->px, psd->y - psd->py); 85 evas_object_move(psd->content, psd->x - psd->px, psd->y - psd->py);
102 psd->px = psd->delta_posx * psd->gravity_x;
103 psd->py = psd->delta_posy * psd->gravity_y;
104} 86}
105 87
106EOLIAN static void 88EOLIAN static void
@@ -205,24 +187,6 @@ _elm_pan_content_size_get(Eo *obj EINA_UNUSED, Elm_Pan_Smart_Data *psd, Evas_Coo
205 if (h) *h = psd->content_h; 187 if (h) *h = psd->content_h;
206} 188}
207 189
208EOLIAN static void
209_elm_pan_gravity_set(Eo *obj EINA_UNUSED, Elm_Pan_Smart_Data *psd, double x, double y)
210{
211 psd->gravity_x = x;
212 psd->gravity_y = y;
213 psd->prev_cw = psd->content_w;
214 psd->prev_ch = psd->content_h;
215 psd->delta_posx = 0;
216 psd->delta_posy = 0;
217}
218
219EOLIAN static void
220_elm_pan_gravity_get(Eo *obj EINA_UNUSED, Elm_Pan_Smart_Data *psd, double *x, double *y)
221{
222 if (x) *x = psd->gravity_x;
223 if (y) *y = psd->gravity_y;
224}
225
226static Evas_Object * 190static Evas_Object *
227_elm_pan_add(Evas *evas) 191_elm_pan_add(Evas *evas)
228{ 192{
@@ -250,8 +214,7 @@ _elm_pan_content_del_cb(void *data,
250 214
251 psd = data; 215 psd = data;
252 psd->content = NULL; 216 psd->content = NULL;
253 psd->content_w = psd->content_h = psd->px = psd->py = 217 psd->content_w = psd->content_h = psd->px = psd->py = 0;
254 psd->prev_cw = psd->prev_ch = psd->delta_posx = psd->delta_posy = 0;
255 efl_event_callback_legacy_call(psd->self, ELM_PAN_EVENT_CHANGED, NULL); 218 efl_event_callback_legacy_call(psd->self, ELM_PAN_EVENT_CHANGED, NULL);
256} 219}
257 220
@@ -1873,6 +1836,12 @@ _elm_scroll_wanted_region_set(Evas_Object *obj)
1873 wh = sid->wh; 1836 wh = sid->wh;
1874 } 1837 }
1875 1838
1839 wx += (sid->content_info.w - sid->prev_cw) * sid->gravity_x;
1840 sid->wy += (sid->content_info.h - sid->prev_ch) * sid->gravity_y;
1841
1842 sid->prev_cw = sid->content_info.w;
1843 sid->prev_ch = sid->content_info.h;
1844
1876 elm_interface_scrollable_content_region_set(obj, wx, sid->wy, ww, wh); 1845 elm_interface_scrollable_content_region_set(obj, wx, sid->wy, ww, wh);
1877} 1846}
1878 1847
@@ -4427,17 +4396,17 @@ _elm_interface_scrollable_region_bring_in(Eo *obj, Elm_Scrollable_Smart_Interfac
4427EOLIAN static void 4396EOLIAN static void
4428_elm_interface_scrollable_gravity_set(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *sid, double x, double y) 4397_elm_interface_scrollable_gravity_set(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *sid, double x, double y)
4429{ 4398{
4430 if (!sid->pan_obj) return; 4399 sid->gravity_x = x;
4431 4400 sid->gravity_y = y;
4432 elm_obj_pan_gravity_set(sid->pan_obj, x, y); 4401 sid->prev_cw = sid->content_info.w;
4402 sid->prev_ch = sid->content_info.h;
4433} 4403}
4434 4404
4435EOLIAN static void 4405EOLIAN static void
4436_elm_interface_scrollable_gravity_get(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *sid, double *x, double *y) 4406_elm_interface_scrollable_gravity_get(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *sid, double *x, double *y)
4437{ 4407{
4438 if (!sid->pan_obj) return; 4408 if (x) *x = sid->gravity_x;
4439 4409 if (y) *y = sid->gravity_y;
4440 elm_obj_pan_gravity_get(sid->pan_obj, x, y);
4441} 4410}
4442 4411
4443EOLIAN static void 4412EOLIAN static void
diff --git a/src/lib/elementary/elm_interface_scrollable.h b/src/lib/elementary/elm_interface_scrollable.h
index aa95df6147..001fb3a2f0 100644
--- a/src/lib/elementary/elm_interface_scrollable.h
+++ b/src/lib/elementary/elm_interface_scrollable.h
@@ -48,8 +48,6 @@ struct _Elm_Pan_Smart_Data
48 Evas_Object *content; 48 Evas_Object *content;
49 Evas_Coord x, y, w, h; 49 Evas_Coord x, y, w, h;
50 Evas_Coord content_w, content_h, px, py; 50 Evas_Coord content_w, content_h, px, py;
51 double gravity_x, gravity_y;
52 Evas_Coord prev_cw, prev_ch, delta_posx, delta_posy;
53}; 51};
54 52
55/** 53/**
@@ -209,6 +207,10 @@ struct _Elm_Scrollable_Smart_Interface_Data
209 unsigned char size_adjust_recurse; 207 unsigned char size_adjust_recurse;
210 unsigned char size_count; 208 unsigned char size_count;
211 void *event_info; 209 void *event_info;
210
211 double gravity_x, gravity_y;
212 Evas_Coord prev_cw, prev_ch;
213
212 Eina_Bool size_adjust_recurse_abort : 1; 214 Eina_Bool size_adjust_recurse_abort : 1;
213 215
214 Eina_Bool momentum_animator_disabled : 1; 216 Eina_Bool momentum_animator_disabled : 1;
diff --git a/src/lib/elementary/elm_pan.eo b/src/lib/elementary/elm_pan.eo
index 164846c257..4fa167edcf 100644
--- a/src/lib/elementary/elm_pan.eo
+++ b/src/lib/elementary/elm_pan.eo
@@ -5,16 +5,6 @@ class Elm.Pan (Efl.Canvas.Group.Clipped)
5 event_prefix: elm_pan; 5 event_prefix: elm_pan;
6 data: Elm_Pan_Smart_Data; 6 data: Elm_Pan_Smart_Data;
7 methods { 7 methods {
8 @property gravity {
9 set {
10 }
11 get {
12 }
13 values {
14 x: double;
15 y: double;
16 }
17 }
18 @property pos { 8 @property pos {
19 set { 9 set {
20 } 10 }