Eina_Value *_recognizer_config_get(const Eo *obj, const char *name);
Eina_Bool _event_multi_touch_get(const Efl_Canvas_Gesture_Touch *event);
+double _angle_get(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2);
+Evas_Coord _finger_gap_length_get(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2, Evas_Coord *x, Evas_Coord *y);
+
typedef struct _Efl_Canvas_Gesture_Manager_Data Efl_Canvas_Gesture_Manager_Data;
typedef struct _Efl_Canvas_Gesture_Recognizer_Data Efl_Canvas_Gesture_Recognizer_Data;
typedef struct _Efl_Canvas_Gesture_Recognizer_Tap_Data Efl_Canvas_Gesture_Recognizer_Tap_Data;
#define EFL_CANVAS_GESTURE_RECOGNIZER_PROTECTED
#include "efl_canvas_gesture_private.h"
+#define RAD2DEG(x) ((x) * 57.295779513)
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_CLASS
#include "efl_canvas_gesture_recognizer.eo.h"
return efl_gesture_touch_points_count_get(event) > 1;
}
+
+double
+_angle_get(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2)
+{
+ double a, xx, yy, rt = (-1);
+
+ xx = abs(xx2 - xx1);
+ yy = abs(yy2 - yy1);
+
+ if (((int)xx) && ((int)yy))
+ {
+ rt = a = RAD2DEG(atan(yy / xx));
+ if (xx1 < xx2)
+ {
+ if (yy1 < yy2) rt = 360 - a;
+ else rt = a;
+ }
+ else
+ {
+ if (yy1 < yy2) rt = 180 + a;
+ else rt = 180 - a;
+ }
+ }
+
+ if (rt < 0) /* Do this only if rt is not set */
+ {
+ if (((int)xx)) /* Horizontal line */
+ {
+ if (xx2 < xx1) rt = 180;
+ else rt = 0.0;
+ }
+ else /* Vertical line */
+ {
+ if (yy2 < yy1) rt = 90;
+ else rt = 270;
+ }
+ }
+
+ /* Now we want to change from:
+ * 90 0
+ * original circle 180 0 We want: 270 90
+ * 270 180
+ */
+ rt = 450 - rt;
+ if (rt >= 360) rt -= 360;
+
+ return rt;
+}
+
+Evas_Coord
+_finger_gap_length_get(Evas_Coord xx1,
+ Evas_Coord yy1,
+ Evas_Coord xx2,
+ Evas_Coord yy2,
+ Evas_Coord *x,
+ Evas_Coord *y)
+{
+ double a, b, xx, yy, gap;
+ xx = abs(xx2 - xx1);
+ yy = abs(yy2 - yy1);
+ gap = sqrt((xx * xx) + (yy * yy));
+
+ /* START - Compute zoom center point */
+ /* The triangle defined as follows:
+ * B
+ * / |
+ * / |
+ * gap / | a
+ * / |
+ * A-----C
+ * b
+ * http://en.wikipedia.org/wiki/Trigonometric_functions
+ *************************************/
+ if (((int)xx) && ((int)yy))
+ {
+ double A = atan((yy / xx));
+ a = (Evas_Coord)((gap / 2) * sin(A));
+ b = (Evas_Coord)((gap / 2) * cos(A));
+ *x = (Evas_Coord)((xx2 > xx1) ? (xx1 + b) : (xx2 + b));
+ *y = (Evas_Coord)((yy2 > yy1) ? (yy1 + a) : (yy2 + a));
+ }
+ else
+ {
+ if ((int)xx) /* horiz line, take half width */
+ {
+ *x = (Evas_Coord)((xx1 + xx2) / 2);
+ *y = (Evas_Coord)(yy1);
+ }
+
+ if ((int)yy) /* vert line, take half width */
+ {
+ *x = (Evas_Coord)(xx1);
+ *y = (Evas_Coord)((yy1 + yy2) / 2);
+ }
+ }
+ /* END - Compute zoom center point */
+
+ return (Evas_Coord)gap;
+}
+
#include "efl_canvas_gesture_recognizer.eo.c"
#define THUMBSCROLL_MOMENTUM_THRESHOLD 100.0
#define EFL_GESTURE_MINIMUM_MOMENTUM 0.001
-#define RAD2DEG(x) ((x) * 57.295779513)
#define DEG2RAD(x) ((x) / 57.295779513)
#define memset do not use memset to reset flick data, use _reset_recognizer
pd->t_st, efl_gesture_touch_current_timestamp_get(event));
}
-static double
-_angle_get(Evas_Coord xx1,
- Evas_Coord yy1,
- Evas_Coord xx2,
- Evas_Coord yy2)
-{
- double a, xx, yy, rt = (-1);
-
- xx = abs(xx2 - xx1);
- yy = abs(yy2 - yy1);
-
- if (((int)xx) && ((int)yy))
- {
- rt = a = RAD2DEG(atan(yy / xx));
- if (xx1 < xx2)
- {
- if (yy1 < yy2) rt = 360 - a;
- else rt = a;
- }
- else
- {
- if (yy1 < yy2) rt = 180 + a;
- else rt = 180 - a;
- }
- }
-
- if (rt < 0) /* Do this only if rt is not set */
- {
- if (((int)xx)) /* Horizontal line */
- {
- if (xx2 < xx1) rt = 180;
- else rt = 0.0;
- }
- else /* Vertical line */
- {
- if (yy2 < yy1) rt = 90;
- else rt = 270;
- }
- }
-
- /* Now we want to change from:
- * 90 0
- * original circle 180 0 We want: 270 90
- * 270 180
- */
- rt = 450 - rt;
- if (rt >= 360) rt -= 360;
-
- return rt;
-}
-
static void
_vector_get(Eina_Position2D v1,
Eina_Position2D v2,
#define memset do not use memset to reset zoom data, use _reset_recognizer
-static Evas_Coord
-_finger_gap_length_get(Evas_Coord xx1,
- Evas_Coord yy1,
- Evas_Coord xx2,
- Evas_Coord yy2,
- Evas_Coord *x,
- Evas_Coord *y)
-{
- double a, b, xx, yy, gap;
- xx = abs(xx2 - xx1);
- yy = abs(yy2 - yy1);
- gap = sqrt((xx * xx) + (yy * yy));
-
- /* START - Compute zoom center point */
- /* The triangle defined as follows:
- * B
- * / |
- * / |
- * gap / | a
- * / |
- * A-----C
- * b
- * http://en.wikipedia.org/wiki/Trigonometric_functions
- *************************************/
- if (((int)xx) && ((int)yy))
- {
- double A = atan((yy / xx));
- a = (Evas_Coord)((gap / 2) * sin(A));
- b = (Evas_Coord)((gap / 2) * cos(A));
- *x = (Evas_Coord)((xx2 > xx1) ? (xx1 + b) : (xx2 + b));
- *y = (Evas_Coord)((yy2 > yy1) ? (yy1 + a) : (yy2 + a));
- }
- else
- {
- if ((int)xx) /* horiz line, take half width */
- {
- *x = (Evas_Coord)((xx1 + xx2) / 2);
- *y = (Evas_Coord)(yy1);
- }
-
- if ((int)yy) /* vert line, take half width */
- {
- *x = (Evas_Coord)(xx1);
- *y = (Evas_Coord)((yy1 + yy2) / 2);
- }
- }
- /* END - Compute zoom center point */
-
- return (Evas_Coord)gap;
-}
-
static double
_zoom_compute(Efl_Canvas_Gesture_Recognizer_Zoom_Data *pd,
Efl_Canvas_Gesture_Zoom_Data *zd,