diff options
author | Mike Blumenkrantz <zmike@samsung.com> | 2020-02-12 09:02:48 -0500 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-02-14 09:21:21 +0100 |
commit | f80189c3435ae4b44aed626ce08682e19e349ada (patch) | |
tree | 866969fcf2ce3b34cf1a3c10a0c783df1dfe89a2 | |
parent | f5c4c4ee1593aeee9955de31b47ce04101ea7d23 (diff) | |
download | efl-f80189c3435ae4b44aed626ce08682e19e349ada.tar.gz |
elm_test: add zoom recognizer handling to gesture test
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D11330
-rw-r--r-- | src/bin/elementary/test_gesture_framework.c | 48 |
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) } static void +finger_zoom_start(void *data , Efl_Canvas_Gesture *tap) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + + _color_and_icon_set(data, ZOOM_NAME, 1, MAX_TAP, START_COLOR); + printf("Zoom Gesture started x,y=<%d,%d> \n", pos.x, pos.y); +} + +static void +finger_zoom_end(void *data , Efl_Canvas_Gesture *tap) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + double zoom = efl_gesture_zoom_get(tap); + double radius = efl_gesture_zoom_radius_get(tap); + + _color_and_icon_set(data, ZOOM_NAME, 1, MAX_TAP, END_COLOR); + printf("Zoom Gesture ended x,y=<%d,%d> zoom=<%g> radius=<%f>\n", pos.x, pos.y, zoom, radius); +} + +static void +finger_zoom_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) +{ + _color_and_icon_set(data, ZOOM_NAME, 1, MAX_TAP, ABORT_COLOR); + printf("Zoom Aborted\n"); +} + +static void finger_momentum_start(void *data , Efl_Canvas_Gesture *tap) { Eina_Position2D pos = efl_gesture_hotspot_get(tap); @@ -405,6 +432,26 @@ flick_gesture_cb(void *data , const Efl_Event *ev) } static void +zoom_gesture_cb(void *data , const Efl_Event *ev) +{ + Efl_Canvas_Gesture *g = ev->info; + switch(efl_gesture_state_get(g)) + { + case EFL_GESTURE_STATE_STARTED: + finger_zoom_start(data, g); + break; + case EFL_GESTURE_STATE_CANCELED: + finger_zoom_abort(data, g); + break; + case EFL_GESTURE_STATE_FINISHED: + finger_zoom_end(data, g); + break; + default: + break; + } +} + +static void momentum_gesture_cb(void *data , const Efl_Event *ev) { Efl_Canvas_Gesture *g = ev->info; @@ -694,6 +741,7 @@ test_gesture_framework(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, efl_event_callback_add(target, EFL_EVENT_GESTURE_TRIPLE_TAP, triple_tap_gesture_cb, infra); efl_event_callback_add(target, EFL_EVENT_GESTURE_MOMENTUM, momentum_gesture_cb, infra); efl_event_callback_add(target, EFL_EVENT_GESTURE_FLICK, flick_gesture_cb, infra); + efl_event_callback_add(target, EFL_EVENT_GESTURE_ZOOM, zoom_gesture_cb, infra); /* Update color state 20 times a second */ infra->colortimer = ecore_timer_add(0.05, _icon_color_set_cb, infra->icons); |