summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-02-19 10:24:04 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-03-03 10:54:28 +0100
commitd300e90d390fc9c764e57dc5806616e43e8db954 (patch)
tree97643567c43cfd6146263ce8146a8fcca3826ef2 /src/bin
parent830cdcf7ea7d45a78f2b08403f9eb5f50f35eeac (diff)
efl/gesture: port 'rotate' gesture from elm to new gesture framework
this is a 1:1 port with minimal changes other than what's necessary to integrate into the new framework Differential Revision: https://phab.enlightenment.org/D11383
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 ff40711cdd..4675604fa3 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_rotate_start(void *data , Efl_Canvas_Gesture *tap)
228{
229 Eina_Position2D pos = efl_gesture_hotspot_get(tap);
230
231 _color_and_icon_set(data, ROTATE_NAME, 1, MAX_TAP, START_COLOR);
232 printf("Rotate Gesture started x,y=<%d,%d> \n", pos.x, pos.y);
233}
234
235static void
236finger_rotate_end(void *data , Efl_Canvas_Gesture *tap)
237{
238 Eina_Position2D pos = efl_gesture_hotspot_get(tap);
239 double angle = efl_gesture_rotate_angle_get(tap);
240 double radius = efl_gesture_rotate_radius_get(tap);
241
242 _color_and_icon_set(data, ROTATE_NAME, 1, MAX_TAP, END_COLOR);
243 printf("Rotate Gesture ended x,y=<%d,%d> angle=<%g> radius=<%f>\n", pos.x, pos.y, angle, radius);
244}
245
246static void
247finger_rotate_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED)
248{
249 _color_and_icon_set(data, ROTATE_NAME, 1, MAX_TAP, ABORT_COLOR);
250 printf("Rotate Aborted\n");
251}
252
253static void
227finger_zoom_start(void *data , Efl_Canvas_Gesture *tap) 254finger_zoom_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);
@@ -432,6 +459,26 @@ flick_gesture_cb(void *data , const Efl_Event *ev)
432} 459}
433 460
434static void 461static void
462rotate_gesture_cb(void *data , const Efl_Event *ev)
463{
464 Efl_Canvas_Gesture *g = ev->info;
465 switch(efl_gesture_state_get(g))
466 {
467 case EFL_GESTURE_STATE_STARTED:
468 finger_rotate_start(data, g);
469 break;
470 case EFL_GESTURE_STATE_CANCELED:
471 finger_rotate_abort(data, g);
472 break;
473 case EFL_GESTURE_STATE_FINISHED:
474 finger_rotate_end(data, g);
475 break;
476 default:
477 break;
478 }
479}
480
481static void
435zoom_gesture_cb(void *data , const Efl_Event *ev) 482zoom_gesture_cb(void *data , const Efl_Event *ev)
436{ 483{
437 Efl_Canvas_Gesture *g = ev->info; 484 Efl_Canvas_Gesture *g = ev->info;
@@ -741,6 +788,7 @@ test_gesture_framework(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
741 efl_event_callback_add(target, EFL_EVENT_GESTURE_TRIPLE_TAP, triple_tap_gesture_cb, infra); 788 efl_event_callback_add(target, EFL_EVENT_GESTURE_TRIPLE_TAP, triple_tap_gesture_cb, infra);
742 efl_event_callback_add(target, EFL_EVENT_GESTURE_MOMENTUM, momentum_gesture_cb, infra); 789 efl_event_callback_add(target, EFL_EVENT_GESTURE_MOMENTUM, momentum_gesture_cb, infra);
743 efl_event_callback_add(target, EFL_EVENT_GESTURE_FLICK, flick_gesture_cb, infra); 790 efl_event_callback_add(target, EFL_EVENT_GESTURE_FLICK, flick_gesture_cb, infra);
791 efl_event_callback_add(target, EFL_EVENT_GESTURE_ROTATE, rotate_gesture_cb, infra);
744 efl_event_callback_add(target, EFL_EVENT_GESTURE_ZOOM, zoom_gesture_cb, infra); 792 efl_event_callback_add(target, EFL_EVENT_GESTURE_ZOOM, zoom_gesture_cb, infra);
745 793
746 /* Update color state 20 times a second */ 794 /* Update color state 20 times a second */