summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-02-12 09:02:48 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-02-14 09:21:21 +0100
commitf80189c3435ae4b44aed626ce08682e19e349ada (patch)
tree866969fcf2ce3b34cf1a3c10a0c783df1dfe89a2 /src/bin
parentf5c4c4ee1593aeee9955de31b47ce04101ea7d23 (diff)
elm_test: add zoom recognizer handling to gesture test
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11330
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/elementary/test_gesture_framework.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/bin/elementary/test_gesture_framework.c b/src/bin/elementary/test_gesture_framework.c
index 3b9e57a986..41a9ffd49a 100644
--- a/src/bin/elementary/test_gesture_framework.c
+++ b/src/bin/elementary/test_gesture_framework.c
@@ -224,6 +224,33 @@ finger_flick_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED)
224} 224}
225 225
226static void 226static void
227finger_zoom_start(void *data , Efl_Canvas_Gesture *tap)
228{
229 Eina_Position2D pos = efl_gesture_hotspot_get(tap);
230
231 _color_and_icon_set(data, ZOOM_NAME, 1, MAX_TAP, START_COLOR);
232 printf("Zoom Gesture started x,y=<%d,%d> \n", pos.x, pos.y);
233}
234
235static void
236finger_zoom_end(void *data , Efl_Canvas_Gesture *tap)
237{
238 Eina_Position2D pos = efl_gesture_hotspot_get(tap);
239 double zoom = efl_gesture_zoom_get(tap);
240 double radius = efl_gesture_zoom_radius_get(tap);
241
242 _color_and_icon_set(data, ZOOM_NAME, 1, MAX_TAP, END_COLOR);
243 printf("Zoom Gesture ended x,y=<%d,%d> zoom=<%g> radius=<%f>\n", pos.x, pos.y, zoom, radius);
244}
245
246static void
247finger_zoom_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED)
248{
249 _color_and_icon_set(data, ZOOM_NAME, 1, MAX_TAP, ABORT_COLOR);
250 printf("Zoom Aborted\n");
251}
252
253static void
227finger_momentum_start(void *data , Efl_Canvas_Gesture *tap) 254finger_momentum_start(void *data , Efl_Canvas_Gesture *tap)
228{ 255{
229 Eina_Position2D pos = efl_gesture_hotspot_get(tap); 256 Eina_Position2D pos = efl_gesture_hotspot_get(tap);
@@ -405,6 +432,26 @@ flick_gesture_cb(void *data , const Efl_Event *ev)
405} 432}
406 433
407static void 434static void
435zoom_gesture_cb(void *data , const Efl_Event *ev)
436{
437 Efl_Canvas_Gesture *g = ev->info;
438 switch(efl_gesture_state_get(g))
439 {
440 case EFL_GESTURE_STATE_STARTED:
441 finger_zoom_start(data, g);
442 break;
443 case EFL_GESTURE_STATE_CANCELED:
444 finger_zoom_abort(data, g);
445 break;
446 case EFL_GESTURE_STATE_FINISHED:
447 finger_zoom_end(data, g);
448 break;
449 default:
450 break;
451 }
452}
453
454static void
408momentum_gesture_cb(void *data , const Efl_Event *ev) 455momentum_gesture_cb(void *data , const Efl_Event *ev)
409{ 456{
410 Efl_Canvas_Gesture *g = ev->info; 457 Efl_Canvas_Gesture *g = ev->info;
@@ -694,6 +741,7 @@ test_gesture_framework(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
694 efl_event_callback_add(target, EFL_EVENT_GESTURE_TRIPLE_TAP, triple_tap_gesture_cb, infra); 741 efl_event_callback_add(target, EFL_EVENT_GESTURE_TRIPLE_TAP, triple_tap_gesture_cb, infra);
695 efl_event_callback_add(target, EFL_EVENT_GESTURE_MOMENTUM, momentum_gesture_cb, infra); 742 efl_event_callback_add(target, EFL_EVENT_GESTURE_MOMENTUM, momentum_gesture_cb, infra);
696 efl_event_callback_add(target, EFL_EVENT_GESTURE_FLICK, flick_gesture_cb, infra); 743 efl_event_callback_add(target, EFL_EVENT_GESTURE_FLICK, flick_gesture_cb, infra);
744 efl_event_callback_add(target, EFL_EVENT_GESTURE_ZOOM, zoom_gesture_cb, infra);
697 745
698 /* Update color state 20 times a second */ 746 /* Update color state 20 times a second */
699 infra->colortimer = ecore_timer_add(0.05, _icon_color_set_cb, infra->icons); 747 infra->colortimer = ecore_timer_add(0.05, _icon_color_set_cb, infra->icons);