value "glayer_zoom_wheel_factor" double: 0.05;
value "glayer_zoom_distance_tolerance" double: 1.0;
value "glayer_rotate_finger_enable" uchar: 0;
- value "glayer_rotate_angular_tolerance" double: 0.034906585;
+ value "glayer_rotate_angular_tolerance" double: 2.0;
value "glayer_line_min_length" double: 1.0;
value "glayer_line_distance_tolerance" double: 3.0;
- value "glayer_line_angular_tolerance" double: 0.34906585; /* Represents 20 DEG */
+ value "glayer_line_angular_tolerance" double: 20.0
value "glayer_flick_time_limit_ms" uint: 120; /* ms to finish flick */
value "glayer_long_tap_start_timeout" double: 1.2; /* sec to start long-tap */
value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */
value "glayer_zoom_wheel_factor" double: 0.05;
value "glayer_zoom_distance_tolerance" double: 1.0;
value "glayer_rotate_finger_enable" uchar: 0;
- value "glayer_rotate_angular_tolerance" double: 0.034906585;
+ value "glayer_rotate_angular_tolerance" double: 2.0;
value "glayer_line_min_length" double: 1.0;
value "glayer_line_distance_tolerance" double: 3.0;
- value "glayer_line_angular_tolerance" double: 0.34906585; /* Represents 20 DEG */
+ value "glayer_line_angular_tolerance" double: 20.0
value "glayer_flick_time_limit_ms" uint: 100; /* ms to finish flick */
value "glayer_long_tap_start_timeout" double: 1.2; /* sec to start long-tap */
value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */
value "glayer_zoom_wheel_factor" double: 0.05;
value "glayer_zoom_distance_tolerance" double: 1.0;
value "glayer_rotate_finger_enable" uchar: 0;
- value "glayer_rotate_angular_tolerance" double: 0.034906585;
+ value "glayer_rotate_angular_tolerance" double: 2.0;
value "glayer_line_min_length" double: 1.0;
value "glayer_line_distance_tolerance" double: 3.0;
- value "glayer_line_angular_tolerance" double: 0.34906585; /* Represents 20 DEG */
+ value "glayer_line_angular_tolerance" double: 20.0;
value "glayer_flick_time_limit_ms" uint: 120; /* ms to finish flick */
value "glayer_long_tap_start_timeout" double: 1.2; /* sec to start long-tap */
value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */
_elm_config->glayer_zoom_wheel_factor = 0.05;
_elm_config->glayer_zoom_distance_tolerance = 1.0; /* 1 times elm_finger_size_get() */
_elm_config->glayer_rotate_finger_enable = EINA_FALSE;
- _elm_config->glayer_rotate_angular_tolerance = 0.034906585; /* Represents 2 DEG */
+ _elm_config->glayer_rotate_angular_tolerance = 2.0; /* 2 DEG */
_elm_config->glayer_line_min_length = 1.0; /* 1 times elm_finger_size_get() */
_elm_config->glayer_line_distance_tolerance = 3.0; /* 3 times elm_finger_size_get() */
- _elm_config->glayer_line_angular_tolerance = 0.34906585; /* Represents 20 DEG */
+ _elm_config->glayer_line_angular_tolerance = 20.0; /* 20 DEG */
_elm_config->glayer_flick_time_limit_ms = 120; /* ms to finish flick */
_elm_config->glayer_long_tap_start_timeout = 1.2; /* 1.2 second to start long-tap */
_elm_config->glayer_continues_enable = EINA_TRUE; /* Continue gestures default */
#define RAD_360DEG (M_PI * 2)
/* #define DEBUG_GESTURE_LAYER 1 */
+#define RAD2DEG(x) ((x) * 57.295779513)
+#define DEG2RAD(x) ((x) / 57.295779513)
+
static void *
_glayer_bufdup(void *buf, size_t size)
{
static double
get_angle(Evas_Coord x1, Evas_Coord y1, Evas_Coord x2, Evas_Coord y2)
{
- double a, xx, yy;
+ double a, xx, yy, rt = (-1);
xx = fabs(x2 - x1);
yy = fabs(y2 - y1);
if (((int) xx) && ((int) yy))
{
- a = atan(yy / xx);
+ rt = a = RAD2DEG(atan(yy / xx));
if (x1 < x2)
{
if (y1 < y2)
{
- return RAD_360DEG - a;
+ rt = 360 - a;
}
else
{
- return (a);
+ rt = (a);
}
}
else
{
if (y1 < y2)
{
- return RAD_180DEG + a;
+ rt = 180 + a;
}
else
{
- return RAD_180DEG - a;
+ rt = 180 - a;
}
}
}
- if (((int) xx))
- { /* Horizontal line */
- if (x2 < x1)
- {
- return RAD_180DEG;
+ if (rt < 0)
+ { /* Do this only if rt is not set */
+ if (((int) xx))
+ { /* Horizontal line */
+ if (x2 < x1)
+ {
+ rt = 180;
+ }
+ else
+ {
+ rt = 0.0;
+ }
}
else
- {
- return 0.0;
+ { /* Vertical line */
+ if (y2 < y1)
+ {
+ rt = 90;
+ }
+ else
+ {
+ rt = 270;
+ }
}
}
- /* Vertical line */
- if (y2 < y1)
- {
- return RAD_90DEG;
- }
- else
- {
- return RAD_270DEG;
- }
+ /* 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;
}
/**
{ /* if line direction was set, we test if broke tolerance */
double a = fabs(angle - line->line_angle);
- double d = (tan(a)) * line->line_length; /* Distance from line */
+ double d = (tan(DEG2RAD(a))) * line->line_length; /* Distance from line */
#if defined(DEBUG_GESTURE_LAYER)
- printf("%s a=<%f> d=<%f>\n", __func__, (a * 57.295779513), d);
+ printf("%s a=<%f> d=<%f>\n", __func__, a, d);
#endif
if ((d > wd->line_distance_tolerance) || (a > wd->line_angular_tolerance))
{ /* Broke tolerance: abort line and start a new one */
if (low < 0)
{
- low += RAD_180DEG;
- high += RAD_180DEG;
+ low += 180;
+ high += 180;
- if (t < RAD_180DEG)
- t += RAD_180DEG;
+ if (t < 180)
+ t += 180;
else
- t -= RAD_180DEG;
+ t -= 180;
}
- if (high > RAD_360DEG)
+ if (high > 360)
{
- low -= RAD_180DEG;
- high -= RAD_180DEG;
+ low -= 180;
+ high -= 180;
- if (t < RAD_180DEG)
- t += RAD_180DEG;
+ if (t < 180)
+ t += 180;
else
- t -= RAD_180DEG;
+ t -= 180;
}
#if defined(DEBUG_GESTURE_LAYER)
Evas_Coord x1, Evas_Coord y1,
Evas_Coord x2, Evas_Coord y2,
double *angle)
-{
+{ /* FIXME: Fix momentum computation, it's wrong */
double prev_angle = *angle;
st->info.radius = get_finger_gap_length(x1, y1, x2, y2,
&st->info.x, &st->info.y) / 2;
unsigned int tm_total = tm_end - tm_start;
if (tm_total)
{ /* Momentum computed as:
- accumulated roation angle (rad) divided by time */
+ accumulated roation angle (deg) divided by time */
double m = 0;;
- if (((prev_angle < RAD_90DEG) && ((*angle) > RAD_270DEG)) ||
- ((prev_angle > RAD_270DEG) && ((*angle) < RAD_90DEG)))
+ if (((prev_angle < 90) && ((*angle) > 270)) ||
+ ((prev_angle > 270) && ((*angle) < 90)))
{ /* We circle passing ZERO point */
prev_angle = (*angle);
}