forked from enlightenment/efl
efl/gesture: formatting
some parts of this were entirely unreadable due to mixed tabs/spaces and other bizarre formatting issues which somehow made it into the tree Differential Revision: https://phab.enlightenment.org/D11053
This commit is contained in:
parent
f849c9637e
commit
c357bcc6dd
|
@ -28,7 +28,6 @@ _efl_canvas_gesture_hotspot_set(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd
|
||||||
pd->hotspot = hotspot;
|
pd->hotspot = hotspot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EOLIAN static Eina_Position2D
|
EOLIAN static Eina_Position2D
|
||||||
_efl_canvas_gesture_hotspot_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd)
|
_efl_canvas_gesture_hotspot_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +40,6 @@ _efl_canvas_gesture_timestamp_set(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *
|
||||||
pd->timestamp = timestamp;
|
pd->timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EOLIAN static unsigned int
|
EOLIAN static unsigned int
|
||||||
_efl_canvas_gesture_timestamp_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd)
|
_efl_canvas_gesture_timestamp_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,33 +4,33 @@
|
||||||
|
|
||||||
typedef struct _Object_Gesture
|
typedef struct _Object_Gesture
|
||||||
{
|
{
|
||||||
Eo *object;
|
Eo *object;
|
||||||
const Efl_Event_Description *type;
|
const Efl_Event_Description *type;
|
||||||
Efl_Canvas_Gesture *gesture;
|
Efl_Canvas_Gesture *gesture;
|
||||||
Efl_Canvas_Gesture_Recognizer *recognizer;
|
Efl_Canvas_Gesture_Recognizer *recognizer;
|
||||||
} Object_Gesture;
|
} Object_Gesture;
|
||||||
|
|
||||||
typedef struct _Efl_Canvas_Gesture_Manager_Data
|
typedef struct _Efl_Canvas_Gesture_Manager_Data
|
||||||
{
|
{
|
||||||
//Keeps track of all the gesture request for a particular target
|
//Keeps track of all the gesture request for a particular target
|
||||||
Eina_Hash *m_gesture_contex; // (*target, *event_desc)
|
Eina_Hash *m_gesture_contex; // (*target, *event_desc)
|
||||||
//Keeps all the event directed to this particular object from touch_begin till touch_end
|
//Keeps all the event directed to this particular object from touch_begin till touch_end
|
||||||
Eina_Hash *m_object_events; // (*target, *efl_gesture_touch)
|
Eina_Hash *m_object_events; // (*target, *efl_gesture_touch)
|
||||||
//Keeps all the recognizer registered to gesture manager
|
//Keeps all the recognizer registered to gesture manager
|
||||||
Eina_Hash *m_recognizers; // (*gesture_type, *recognizer)
|
Eina_Hash *m_recognizers; // (*gesture_type, *recognizer)
|
||||||
//Keeps track of all current object gestures.
|
//Keeps track of all current object gestures.
|
||||||
Eina_List *m_object_gestures; //(List of *object_gesture)
|
Eina_List *m_object_gestures; //(List of *object_gesture)
|
||||||
//Lazy deletion of gestures
|
//Lazy deletion of gestures
|
||||||
Eina_List *m_gestures_to_delete;
|
Eina_List *m_gestures_to_delete;
|
||||||
//Kepps config values for gesture recognize
|
//Kepps config values for gesture recognize
|
||||||
Eina_Hash *m_config;
|
Eina_Hash *m_config;
|
||||||
} Efl_Canvas_Gesture_Manager_Data;
|
} Efl_Canvas_Gesture_Manager_Data;
|
||||||
|
|
||||||
static void _cleanup_cached_gestures(Efl_Canvas_Gesture_Manager_Data *pd,
|
static void _cleanup_cached_gestures(Efl_Canvas_Gesture_Manager_Data *pd,
|
||||||
Eo *target, const Efl_Event_Description *type);
|
Eo *target, const Efl_Event_Description *type);
|
||||||
static Efl_Canvas_Gesture*
|
static Efl_Canvas_Gesture *
|
||||||
_get_state(Efl_Canvas_Gesture_Manager_Data *pd, Eo *target,
|
_get_state(Efl_Canvas_Gesture_Manager_Data *pd, Eo *target,
|
||||||
Efl_Canvas_Gesture_Recognizer *recognizer, const Efl_Event_Description *type);
|
Efl_Canvas_Gesture_Recognizer *recognizer, const Efl_Event_Description *type);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cleanup_object(Eina_List *list)
|
_cleanup_object(Eina_List *list)
|
||||||
|
@ -131,7 +131,7 @@ _efl_canvas_gesture_manager_callback_add_hook(void *data, Eo *target, const Efl_
|
||||||
{
|
{
|
||||||
Efl_Canvas_Gesture_Manager_Data *pd = data;
|
Efl_Canvas_Gesture_Manager_Data *pd = data;
|
||||||
//If there is a recognizer registered for that event then add it to the gesture context
|
//If there is a recognizer registered for that event then add it to the gesture context
|
||||||
Efl_Canvas_Gesture_Recognizer *recognizer = eina_hash_find (pd->m_recognizers, &type);
|
Efl_Canvas_Gesture_Recognizer *recognizer = eina_hash_find(pd->m_recognizers, &type);
|
||||||
if (recognizer)
|
if (recognizer)
|
||||||
{
|
{
|
||||||
//Add it to the gesture context.
|
//Add it to the gesture context.
|
||||||
|
@ -144,7 +144,7 @@ _efl_canvas_gesture_manager_callback_del_hook(void *data, Eo *target, const Efl_
|
||||||
{
|
{
|
||||||
Efl_Canvas_Gesture_Manager_Data *pd = data;
|
Efl_Canvas_Gesture_Manager_Data *pd = data;
|
||||||
//If there is a recognizer registered for that event then add it to the gesture context
|
//If there is a recognizer registered for that event then add it to the gesture context
|
||||||
Efl_Canvas_Gesture_Recognizer *recognizer = eina_hash_find (pd->m_recognizers, &type);
|
Efl_Canvas_Gesture_Recognizer *recognizer = eina_hash_find(pd->m_recognizers, &type);
|
||||||
if (recognizer)
|
if (recognizer)
|
||||||
{
|
{
|
||||||
eina_hash_list_remove(pd->m_gesture_contex, &target, type);
|
eina_hash_list_remove(pd->m_gesture_contex, &target, type);
|
||||||
|
@ -181,18 +181,18 @@ _efl_canvas_gesture_manager_filter_event(void *data, Eo *target, void *event)
|
||||||
efl_gesture_touch_point_record(touch_event, event);
|
efl_gesture_touch_point_record(touch_event, event);
|
||||||
|
|
||||||
//This is for handling the case that mouse event pairs dont match.
|
//This is for handling the case that mouse event pairs dont match.
|
||||||
//Such as the case of canceling gesture recognition after a mouse down.
|
//Such as the case of canceling gesture recognition after a mouse down.
|
||||||
if (efl_gesture_touch_state_get(touch_event) == EFL_GESTURE_TOUCH_STATE_UNKNOWN)
|
if (efl_gesture_touch_state_get(touch_event) == EFL_GESTURE_TOUCH_STATE_UNKNOWN)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
recognizer = eina_hash_find(pd->m_recognizers, &gesture_type);
|
recognizer = eina_hash_find(pd->m_recognizers, &gesture_type);
|
||||||
|
|
||||||
//If the gesture canceled or already finished by recognizer.
|
//If the gesture canceled or already finished by recognizer.
|
||||||
gesture = _get_state(pd, target, recognizer, gesture_type);
|
gesture = _get_state(pd, target, recognizer, gesture_type);
|
||||||
if (!gesture)
|
if (!gesture)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Gesture detecting.
|
//Gesture detecting.
|
||||||
recog_result = efl_gesture_recognizer_recognize(recognizer, gesture, target, touch_event);
|
recog_result = efl_gesture_recognizer_recognize(recognizer, gesture, target, touch_event);
|
||||||
recog_state = recog_result & EFL_GESTURE_RECOGNIZER_RESULT_RESULT_MASK;
|
recog_state = recog_result & EFL_GESTURE_RECOGNIZER_RESULT_RESULT_MASK;
|
||||||
|
|
||||||
|
@ -242,7 +242,6 @@ post_event:
|
||||||
//FIXME: delete it by object not list.
|
//FIXME: delete it by object not list.
|
||||||
_cleanup_object(pd->m_gestures_to_delete);
|
_cleanup_object(pd->m_gestures_to_delete);
|
||||||
pd->m_gestures_to_delete = NULL;
|
pd->m_gestures_to_delete = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,7 +270,7 @@ _efl_canvas_gesture_manager_recognizer_register(Eo *obj EINA_UNUSED, Efl_Canvas_
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_gesture_manager_recognizer_unregister(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Manager_Data *pd,
|
_efl_canvas_gesture_manager_recognizer_unregister(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Manager_Data *pd,
|
||||||
Efl_Canvas_Gesture_Recognizer *recognizer)
|
Efl_Canvas_Gesture_Recognizer *recognizer)
|
||||||
{
|
{
|
||||||
Eina_List *l, *l_next;
|
Eina_List *l, *l_next;
|
||||||
Object_Gesture *object_gesture;
|
Object_Gesture *object_gesture;
|
||||||
|
@ -282,7 +281,7 @@ _efl_canvas_gesture_manager_recognizer_unregister(Eo *obj EINA_UNUSED, Efl_Canva
|
||||||
|
|
||||||
//Find the type of the recognizer
|
//Find the type of the recognizer
|
||||||
dummy = efl_gesture_recognizer_add(recognizer, 0);
|
dummy = efl_gesture_recognizer_add(recognizer, 0);
|
||||||
if (!dummy)return;
|
if (!dummy) return;
|
||||||
|
|
||||||
type = _efl_gesture_type_get(dummy);
|
type = _efl_gesture_type_get(dummy);
|
||||||
efl_del(dummy);
|
efl_del(dummy);
|
||||||
|
@ -313,43 +312,50 @@ _find_match_recognizer(Efl_Canvas_Gesture_Manager_Data *pd, Efl_Canvas_Gesture_R
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case EFL_GESTURE_RECOGNIZER_TYPE_TAP:
|
case EFL_GESTURE_RECOGNIZER_TYPE_TAP:
|
||||||
{
|
{
|
||||||
event_type = EFL_EVENT_GESTURE_TAP;
|
event_type = EFL_EVENT_GESTURE_TAP;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EFL_GESTURE_RECOGNIZER_TYPE_DOUBLETAP:
|
|
||||||
{
|
case EFL_GESTURE_RECOGNIZER_TYPE_DOUBLETAP:
|
||||||
event_type = EFL_EVENT_GESTURE_DOUBLE_TAP;
|
{
|
||||||
break;
|
event_type = EFL_EVENT_GESTURE_DOUBLE_TAP;
|
||||||
}
|
break;
|
||||||
case EFL_GESTURE_RECOGNIZER_TYPE_TRIPLETAP:
|
}
|
||||||
{
|
|
||||||
event_type = EFL_EVENT_GESTURE_TRIPLE_TAP;
|
case EFL_GESTURE_RECOGNIZER_TYPE_TRIPLETAP:
|
||||||
break;
|
{
|
||||||
}
|
event_type = EFL_EVENT_GESTURE_TRIPLE_TAP;
|
||||||
case EFL_GESTURE_RECOGNIZER_TYPE_LONGTAP:
|
break;
|
||||||
{
|
}
|
||||||
event_type = EFL_EVENT_GESTURE_LONG_TAP;
|
|
||||||
break;
|
case EFL_GESTURE_RECOGNIZER_TYPE_LONGTAP:
|
||||||
}
|
{
|
||||||
case EFL_GESTURE_RECOGNIZER_TYPE_MOMENTUM:
|
event_type = EFL_EVENT_GESTURE_LONG_TAP;
|
||||||
{
|
break;
|
||||||
event_type = EFL_EVENT_GESTURE_MOMENTUM;
|
}
|
||||||
break;
|
|
||||||
}
|
case EFL_GESTURE_RECOGNIZER_TYPE_MOMENTUM:
|
||||||
case EFL_GESTURE_RECOGNIZER_TYPE_FLICK:
|
{
|
||||||
{
|
event_type = EFL_EVENT_GESTURE_MOMENTUM;
|
||||||
event_type = EFL_EVENT_GESTURE_FLICK;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
case EFL_GESTURE_RECOGNIZER_TYPE_ZOOM:
|
case EFL_GESTURE_RECOGNIZER_TYPE_FLICK:
|
||||||
{
|
{
|
||||||
event_type = EFL_EVENT_GESTURE_ZOOM;
|
event_type = EFL_EVENT_GESTURE_FLICK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
return NULL;
|
case EFL_GESTURE_RECOGNIZER_TYPE_ZOOM:
|
||||||
|
{
|
||||||
|
event_type = EFL_EVENT_GESTURE_ZOOM;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return eina_hash_find(pd->m_recognizers, &event_type);
|
return eina_hash_find(pd->m_recognizers, &event_type);
|
||||||
|
@ -386,7 +392,7 @@ _efl_canvas_gesture_manager_recognizer_get(Eo *obj EINA_UNUSED, Efl_Canvas_Gestu
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//Get or create a gesture object that will represent the state for a given object, used by the recognizer
|
//Get or create a gesture object that will represent the state for a given object, used by the recognizer
|
||||||
Efl_Canvas_Gesture*
|
Efl_Canvas_Gesture *
|
||||||
_get_state(Efl_Canvas_Gesture_Manager_Data *pd,
|
_get_state(Efl_Canvas_Gesture_Manager_Data *pd,
|
||||||
Eo *target, Efl_Canvas_Gesture_Recognizer *recognizer, const Efl_Event_Description *type)
|
Eo *target, Efl_Canvas_Gesture_Recognizer *recognizer, const Efl_Event_Description *type)
|
||||||
{
|
{
|
||||||
|
@ -407,20 +413,20 @@ _get_state(Efl_Canvas_Gesture_Manager_Data *pd,
|
||||||
if (object_gesture->object == target &&
|
if (object_gesture->object == target &&
|
||||||
object_gesture->recognizer == recognizer &&
|
object_gesture->recognizer == recognizer &&
|
||||||
object_gesture->type == type)
|
object_gesture->type == type)
|
||||||
{
|
{
|
||||||
//The gesture is already processed waiting for cleanup
|
//The gesture is already processed waiting for cleanup
|
||||||
if (((efl_gesture_state_get(object_gesture->gesture) == EFL_GESTURE_STATE_FINISHED) ||
|
if (((efl_gesture_state_get(object_gesture->gesture) == EFL_GESTURE_STATE_FINISHED) ||
|
||||||
(efl_gesture_state_get(object_gesture->gesture) == EFL_GESTURE_STATE_CANCELED)) &&
|
(efl_gesture_state_get(object_gesture->gesture) == EFL_GESTURE_STATE_CANCELED)) &&
|
||||||
(!rd->continues))
|
(!rd->continues))
|
||||||
{
|
{
|
||||||
_cleanup_cached_gestures(pd, target, type);
|
_cleanup_cached_gestures(pd, target, type);
|
||||||
eina_hash_del(pd->m_object_events, &type, NULL);
|
eina_hash_del(pd->m_object_events, &type, NULL);
|
||||||
_cleanup_object(pd->m_gestures_to_delete);
|
_cleanup_object(pd->m_gestures_to_delete);
|
||||||
pd->m_gestures_to_delete = NULL;
|
pd->m_gestures_to_delete = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return object_gesture->gesture;
|
return object_gesture->gesture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gesture = efl_gesture_recognizer_add(recognizer, target);
|
gesture = efl_gesture_recognizer_add(recognizer, target);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "efl_canvas_gesture_private.h"
|
#include "efl_canvas_gesture_private.h"
|
||||||
|
|
||||||
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_CLASS
|
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_CLASS
|
||||||
|
|
||||||
#define EFL_GESTURE_RECOGNIZER_TYPE_TAP_FINGER_SIZE 10
|
#define EFL_GESTURE_RECOGNIZER_TYPE_TAP_FINGER_SIZE 10
|
||||||
EOLIAN static Eina_Value *
|
EOLIAN static Eina_Value *
|
||||||
|
@ -11,9 +11,8 @@ _efl_canvas_gesture_recognizer_config_get(const Eo *obj EINA_UNUSED, Efl_Canvas_
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_gesture_recognizer_reset(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Data *pd EINA_UNUSED,
|
_efl_canvas_gesture_recognizer_reset(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Data *pd EINA_UNUSED,
|
||||||
Efl_Canvas_Gesture *gesture EINA_UNUSED)
|
Efl_Canvas_Gesture *gesture EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Efl_Object *
|
EOLIAN static Efl_Object *
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "efl_canvas_gesture_private.h"
|
#include "efl_canvas_gesture_private.h"
|
||||||
|
|
||||||
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_DOUBLE_TAP_CLASS
|
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_DOUBLE_TAP_CLASS
|
||||||
|
|
||||||
#define TAP_TIME_OUT 0.33
|
#define TAP_TIME_OUT 0.33
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ _efl_canvas_gesture_recognizer_double_tap_efl_canvas_gesture_recognizer_recogniz
|
||||||
if (!pd->start_timeout)
|
if (!pd->start_timeout)
|
||||||
{
|
{
|
||||||
double time;
|
double time;
|
||||||
Eina_Value *val = efl_gesture_recognizer_config_get(obj, "glayer_doublee_tap_timeout");
|
Eina_Value *val = efl_gesture_recognizer_config_get(obj, "glayer_doublee_tap_timeout");
|
||||||
|
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
|
@ -73,80 +73,64 @@ _efl_canvas_gesture_recognizer_double_tap_efl_canvas_gesture_recognizer_recogniz
|
||||||
switch (efl_gesture_touch_state_get(event))
|
switch (efl_gesture_touch_state_get(event))
|
||||||
{
|
{
|
||||||
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
||||||
{
|
{
|
||||||
pos = efl_gesture_touch_start_point_get(event);
|
pos = efl_gesture_touch_start_point_get(event);
|
||||||
efl_gesture_hotspot_set(gesture, pos);
|
efl_gesture_hotspot_set(gesture, pos);
|
||||||
|
|
||||||
if (pd->timeout)
|
if (pd->timeout)
|
||||||
ecore_timer_reset(pd->timeout);
|
ecore_timer_reset(pd->timeout);
|
||||||
else
|
else
|
||||||
pd->timeout = ecore_timer_add(timeout, _tap_timeout_cb, obj);
|
pd->timeout = ecore_timer_add(timeout, _tap_timeout_cb, obj);
|
||||||
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
||||||
|
{
|
||||||
|
result = EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
||||||
|
|
||||||
|
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
|
||||||
|
!efl_gesture_touch_multi_touch_get(event))
|
||||||
{
|
{
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
dist = efl_gesture_touch_distance(event, 0);
|
||||||
|
length = fabs(dist.x) + fabs(dist.y);
|
||||||
|
|
||||||
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
|
if (length > rd->finger_size)
|
||||||
!efl_gesture_touch_multi_touch_get(event))
|
|
||||||
{
|
{
|
||||||
dist = efl_gesture_touch_distance(event, 0);
|
if (pd->timeout)
|
||||||
length = fabs(dist.x) + fabs(dist.y);
|
{
|
||||||
|
ecore_timer_del(pd->timeout);
|
||||||
|
pd->timeout = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (length > rd->finger_size)
|
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
||||||
|
|
||||||
|
pd->tap_count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case EFL_GESTURE_TOUCH_STATE_END:
|
||||||
|
{
|
||||||
|
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
|
||||||
|
!efl_gesture_touch_multi_touch_get(event))
|
||||||
|
{
|
||||||
|
dist = efl_gesture_touch_distance(event, 0);
|
||||||
|
length = fabs(dist.x) + fabs(dist.y);
|
||||||
|
|
||||||
|
if (length <= rd->finger_size)
|
||||||
|
{
|
||||||
|
pd->tap_count++;
|
||||||
|
if (pd->tap_count == 1)
|
||||||
{
|
{
|
||||||
if (pd->timeout)
|
if (pd->timeout)
|
||||||
{
|
ecore_timer_reset(pd->timeout);
|
||||||
ecore_timer_del(pd->timeout);
|
|
||||||
pd->timeout = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
|
|
||||||
pd->tap_count = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case EFL_GESTURE_TOUCH_STATE_END:
|
|
||||||
{
|
|
||||||
|
|
||||||
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
|
|
||||||
!efl_gesture_touch_multi_touch_get(event))
|
|
||||||
{
|
|
||||||
dist = efl_gesture_touch_distance(event, 0);
|
|
||||||
length = fabs(dist.x) + fabs(dist.y);
|
|
||||||
|
|
||||||
if (length <= rd->finger_size)
|
|
||||||
{
|
|
||||||
pd->tap_count++;
|
|
||||||
if (pd->tap_count == 1)
|
|
||||||
{
|
|
||||||
if (pd->timeout)
|
|
||||||
ecore_timer_reset(pd->timeout);
|
|
||||||
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (pd->timeout)
|
|
||||||
{
|
|
||||||
ecore_timer_del(pd->timeout);
|
|
||||||
pd->timeout = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_STATE_END)
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
|
||||||
else
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
|
||||||
|
|
||||||
pd->tap_count = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -156,15 +140,31 @@ _efl_canvas_gesture_recognizer_double_tap_efl_canvas_gesture_recognizer_recogniz
|
||||||
pd->timeout = NULL;
|
pd->timeout = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_STATE_END)
|
||||||
|
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
||||||
|
else
|
||||||
|
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
|
|
||||||
pd->tap_count = 0;
|
pd->tap_count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pd->timeout)
|
||||||
|
{
|
||||||
|
ecore_timer_del(pd->timeout);
|
||||||
|
pd->timeout = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
||||||
|
|
||||||
|
pd->tap_count = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include "efl_canvas_gesture_private.h"
|
#include "efl_canvas_gesture_private.h"
|
||||||
|
|
||||||
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_FLICK_CLASS
|
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_FLICK_CLASS
|
||||||
|
|
||||||
#define MOMENTUM_TIMEOUT 50
|
#define MOMENTUM_TIMEOUT 50
|
||||||
#define THUMBSCROLL_FRICTION 0.95
|
#define THUMBSCROLL_FRICTION 0.95
|
||||||
#define THUMBSCROLL_MOMENTUM_THRESHOLD 100.0
|
#define THUMBSCROLL_MOMENTUM_THRESHOLD 100.0
|
||||||
#define EFL_GESTURE_MINIMUM_MOMENTUM 0.001
|
#define EFL_GESTURE_MINIMUM_MOMENTUM 0.001
|
||||||
|
|
||||||
#define RAD2DEG(x) ((x) * 57.295779513)
|
#define RAD2DEG(x) ((x) * 57.295779513)
|
||||||
#define DEG2RAD(x) ((x) / 57.295779513)
|
#define DEG2RAD(x) ((x) / 57.295779513)
|
||||||
|
@ -70,32 +70,32 @@ _single_line_process(Eo *obj,
|
||||||
{
|
{
|
||||||
switch (efl_gesture_touch_state_get(event))
|
switch (efl_gesture_touch_state_get(event))
|
||||||
{
|
{
|
||||||
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
||||||
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
||||||
if (!pd->t_st)
|
if (!pd->t_st)
|
||||||
{
|
{
|
||||||
pd->st_line = efl_gesture_touch_cur_point_get(event);
|
pd->st_line = efl_gesture_touch_cur_point_get(event);
|
||||||
pd->t_st = efl_gesture_touch_cur_timestamp_get(event);
|
pd->t_st = efl_gesture_touch_cur_timestamp_get(event);
|
||||||
|
|
||||||
efl_gesture_hotspot_set(gesture, pd->st_line);
|
efl_gesture_hotspot_set(gesture, pd->st_line);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFL_GESTURE_TOUCH_STATE_END:
|
||||||
|
{
|
||||||
|
if (!pd->t_st) return;
|
||||||
|
|
||||||
|
pd->t_end = efl_gesture_touch_cur_timestamp_get(event);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case EFL_GESTURE_TOUCH_STATE_END:
|
default:
|
||||||
{
|
|
||||||
if (!pd->t_st) return;
|
|
||||||
|
|
||||||
pd->t_end = efl_gesture_touch_cur_timestamp_get(event);
|
return;
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_momentum_set(obj, fd, pd->st_line, efl_gesture_touch_cur_point_get(event),
|
_momentum_set(obj, fd, pd->st_line, efl_gesture_touch_cur_point_get(event),
|
||||||
|
@ -135,8 +135,8 @@ _angle_get(Evas_Coord xx1,
|
||||||
if (xx2 < xx1) rt = 180;
|
if (xx2 < xx1) rt = 180;
|
||||||
else rt = 0.0;
|
else rt = 0.0;
|
||||||
}
|
}
|
||||||
else
|
else /* Vertical line */
|
||||||
{ /* Vertical line */
|
{
|
||||||
if (yy2 < yy1) rt = 90;
|
if (yy2 < yy1) rt = 90;
|
||||||
else rt = 270;
|
else rt = 270;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,6 @@ _angle_get(Evas_Coord xx1,
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_vector_get(Eina_Position2D v1,
|
_vector_get(Eina_Position2D v1,
|
||||||
Eina_Position2D v2,
|
Eina_Position2D v2,
|
||||||
|
@ -202,11 +201,11 @@ _efl_canvas_gesture_recognizer_flick_efl_canvas_gesture_recognizer_recognize(Eo
|
||||||
|
|
||||||
if (glayer_continues_enable && !pd->touched)
|
if (glayer_continues_enable && !pd->touched)
|
||||||
{
|
{
|
||||||
pd->touched = EINA_TRUE;
|
pd->touched = EINA_TRUE;
|
||||||
pd->line_angle = -1.0;
|
pd->line_angle = -1.0;
|
||||||
rd->continues = EINA_TRUE;
|
rd->continues = EINA_TRUE;
|
||||||
|
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_single_line_process(obj, pd, gesture, fd, event);
|
_single_line_process(obj, pd, gesture, fd, event);
|
||||||
|
@ -262,7 +261,6 @@ _efl_canvas_gesture_recognizer_flick_efl_canvas_gesture_recognizer_recognize(Eo
|
||||||
|
|
||||||
if (pd->line_length >= line_min_length)
|
if (pd->line_length >= line_min_length)
|
||||||
fd->angle = pd->line_angle = angle;
|
fd->angle = pd->line_angle = angle;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pd->t_end)
|
if (pd->t_end)
|
||||||
|
@ -291,57 +289,57 @@ _efl_canvas_gesture_recognizer_flick_efl_canvas_gesture_recognizer_recognize(Eo
|
||||||
else time_limit_ms = 120;
|
else time_limit_ms = 120;
|
||||||
|
|
||||||
if ((tm_end - pd->t_st) > time_limit_ms)
|
if ((tm_end - pd->t_st) > time_limit_ms)
|
||||||
{
|
{
|
||||||
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Flick_Data));
|
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Flick_Data));
|
||||||
|
|
||||||
if (touch_up) rd->continues = EINA_FALSE;
|
if (touch_up) rd->continues = EINA_FALSE;
|
||||||
|
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (efl_gesture_touch_state_get(event))
|
switch (efl_gesture_touch_state_get(event))
|
||||||
{
|
{
|
||||||
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
||||||
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
||||||
{
|
{
|
||||||
if (pd->t_st)
|
if (pd->t_st)
|
||||||
{
|
{
|
||||||
if (glayer_continues_enable && pd->t_end)
|
if (glayer_continues_enable && pd->t_end)
|
||||||
{
|
{
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFL_GESTURE_TOUCH_STATE_END:
|
case EFL_GESTURE_TOUCH_STATE_END:
|
||||||
{
|
{
|
||||||
if (!pd->t_st)
|
if (!pd->t_st)
|
||||||
{
|
{
|
||||||
pd->touched = EINA_FALSE;
|
pd->touched = EINA_FALSE;
|
||||||
rd->continues = EINA_FALSE;
|
rd->continues = EINA_FALSE;
|
||||||
|
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
||||||
}
|
}
|
||||||
if (pd->t_st && pd->t_end)
|
if (pd->t_st && pd->t_end)
|
||||||
{
|
{
|
||||||
rd->continues = EINA_FALSE;
|
rd->continues = EINA_FALSE;
|
||||||
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
||||||
}
|
}
|
||||||
|
|
||||||
efl_gesture_hotspot_set(gesture, efl_gesture_touch_cur_point_get(event));
|
efl_gesture_hotspot_set(gesture, efl_gesture_touch_cur_point_get(event));
|
||||||
|
|
||||||
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Flick_Data));
|
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Flick_Data));
|
||||||
|
|
||||||
rd->continues = EINA_FALSE;
|
rd->continues = EINA_FALSE;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "efl_canvas_gesture_private.h"
|
#include "efl_canvas_gesture_private.h"
|
||||||
|
|
||||||
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_LONG_TAP_CLASS
|
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_LONG_TAP_CLASS
|
||||||
|
|
||||||
#define EFL_GESTURE_LONG_TAP_TIME_OUT 1.2
|
#define EFL_GESTURE_LONG_TAP_TIME_OUT 1.2
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ _efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_recognize(
|
||||||
if (!pd->start_timeout)
|
if (!pd->start_timeout)
|
||||||
{
|
{
|
||||||
double time;
|
double time;
|
||||||
Eina_Value *val = efl_gesture_recognizer_config_get(obj, "glayer_long_tap_start_timeout");
|
Eina_Value *val = efl_gesture_recognizer_config_get(obj, "glayer_long_tap_start_timeout");
|
||||||
|
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
|
@ -67,74 +67,73 @@ _efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_recognize(
|
||||||
else
|
else
|
||||||
timeout = pd->start_timeout;
|
timeout = pd->start_timeout;
|
||||||
|
|
||||||
|
|
||||||
switch (efl_gesture_touch_state_get(event))
|
switch (efl_gesture_touch_state_get(event))
|
||||||
{
|
{
|
||||||
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
||||||
{
|
{
|
||||||
pos = efl_gesture_touch_start_point_get(event);
|
pos = efl_gesture_touch_start_point_get(event);
|
||||||
efl_gesture_hotspot_set(gesture, pos);
|
efl_gesture_hotspot_set(gesture, pos);
|
||||||
|
|
||||||
if (pd->timeout)
|
if (pd->timeout)
|
||||||
{
|
{
|
||||||
ecore_timer_del(pd->timeout);
|
ecore_timer_del(pd->timeout);
|
||||||
}
|
}
|
||||||
pd->timeout = ecore_timer_add(timeout,
|
pd->timeout = ecore_timer_add(timeout,
|
||||||
_long_tap_timeout_cb, pd);
|
_long_tap_timeout_cb, pd);
|
||||||
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
||||||
{
|
{
|
||||||
dist = efl_gesture_touch_distance(event, 0);
|
dist = efl_gesture_touch_distance(event, 0);
|
||||||
length = fabs(dist.x) + fabs(dist.y);
|
length = fabs(dist.x) + fabs(dist.y);
|
||||||
|
|
||||||
if ((efl_gesture_touch_multi_touch_get(event)) || (length > rd->finger_size))
|
if ((efl_gesture_touch_multi_touch_get(event)) || (length > rd->finger_size))
|
||||||
{
|
{
|
||||||
if (pd->timeout)
|
if (pd->timeout)
|
||||||
{
|
{
|
||||||
ecore_timer_del(pd->timeout);
|
ecore_timer_del(pd->timeout);
|
||||||
pd->timeout = NULL;
|
pd->timeout = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_MAYBE;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_MAYBE;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFL_GESTURE_TOUCH_STATE_END:
|
case EFL_GESTURE_TOUCH_STATE_END:
|
||||||
{
|
{
|
||||||
if (pd->timeout)
|
if (pd->timeout)
|
||||||
{
|
{
|
||||||
ecore_timer_del(pd->timeout);
|
ecore_timer_del(pd->timeout);
|
||||||
pd->timeout = NULL;
|
pd->timeout = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
|
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
|
||||||
!efl_gesture_touch_multi_touch_get(event))
|
!efl_gesture_touch_multi_touch_get(event))
|
||||||
{
|
{
|
||||||
dist = efl_gesture_touch_distance(event, 0);
|
dist = efl_gesture_touch_distance(event, 0);
|
||||||
length = fabs(dist.x) + fabs(dist.y);
|
length = fabs(dist.x) + fabs(dist.y);
|
||||||
if (length <= rd->finger_size && pd->is_timeout)
|
if (length <= rd->finger_size && pd->is_timeout)
|
||||||
{
|
{
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include "efl_canvas_gesture_private.h"
|
#include "efl_canvas_gesture_private.h"
|
||||||
|
|
||||||
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_MOMENTUM_CLASS
|
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_MOMENTUM_CLASS
|
||||||
|
|
||||||
#define MOMENTUM_TIMEOUT 50
|
#define MOMENTUM_TIMEOUT 50
|
||||||
#define THUMBSCROLL_FRICTION 0.95
|
#define THUMBSCROLL_FRICTION 0.95
|
||||||
#define THUMBSCROLL_MOMENTUM_THRESHOLD 100.0
|
#define THUMBSCROLL_MOMENTUM_THRESHOLD 100.0
|
||||||
#define EFL_GESTURE_MINIMUM_MOMENTUM 0.001
|
#define EFL_GESTURE_MINIMUM_MOMENTUM 0.001
|
||||||
|
|
||||||
EOLIAN static Efl_Canvas_Gesture *
|
EOLIAN static Efl_Canvas_Gesture *
|
||||||
_efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_add(Eo *obj, Efl_Canvas_Gesture_Recognizer_Momentum_Data *pd EINA_UNUSED, Efl_Object *target EINA_UNUSED)
|
_efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_add(Eo *obj, Efl_Canvas_Gesture_Recognizer_Momentum_Data *pd EINA_UNUSED, Efl_Object *target EINA_UNUSED)
|
||||||
|
@ -32,7 +32,7 @@ _momentum_set(Eo *obj,
|
||||||
{
|
{
|
||||||
velx = (dx * 1000) / dt;
|
velx = (dx * 1000) / dt;
|
||||||
vely = (dy * 1000) / dt;
|
vely = (dy * 1000) / dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
vel = sqrt((velx * velx) + (vely * vely));
|
vel = sqrt((velx * velx) + (vely * vely));
|
||||||
|
|
||||||
|
@ -70,9 +70,9 @@ _direction_get(Evas_Coord xx1,
|
||||||
|
|
||||||
EOLIAN static Efl_Canvas_Gesture_Recognizer_Result
|
EOLIAN static Efl_Canvas_Gesture_Recognizer_Result
|
||||||
_efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize(Eo *obj,
|
_efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize(Eo *obj,
|
||||||
Efl_Canvas_Gesture_Recognizer_Momentum_Data *pd,
|
Efl_Canvas_Gesture_Recognizer_Momentum_Data *pd,
|
||||||
Efl_Canvas_Gesture *gesture, Efl_Object *watched EINA_UNUSED,
|
Efl_Canvas_Gesture *gesture, Efl_Object *watched EINA_UNUSED,
|
||||||
Efl_Canvas_Gesture_Touch *event)
|
Efl_Canvas_Gesture_Touch *event)
|
||||||
{
|
{
|
||||||
Eina_Value *val;
|
Eina_Value *val;
|
||||||
unsigned char glayer_continues_enable;
|
unsigned char glayer_continues_enable;
|
||||||
|
@ -87,104 +87,104 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize(
|
||||||
//It does not have any meanging of this gesture.
|
//It does not have any meanging of this gesture.
|
||||||
if (glayer_continues_enable && !pd->touched)
|
if (glayer_continues_enable && !pd->touched)
|
||||||
{
|
{
|
||||||
pd->touched = EINA_TRUE;
|
pd->touched = EINA_TRUE;
|
||||||
|
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (efl_gesture_touch_state_get(event))
|
switch (efl_gesture_touch_state_get(event))
|
||||||
{
|
{
|
||||||
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
||||||
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
||||||
{
|
{
|
||||||
if (!pd->t_st)
|
if (!pd->t_st)
|
||||||
{
|
{
|
||||||
if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_STATE_BEGIN ||
|
if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_STATE_BEGIN ||
|
||||||
glayer_continues_enable)
|
glayer_continues_enable)
|
||||||
{
|
{
|
||||||
pd->t_st = pd->t_end = efl_gesture_touch_cur_timestamp_get(event);
|
pd->t_st = pd->t_end = efl_gesture_touch_cur_timestamp_get(event);
|
||||||
|
|
||||||
pd->st_line = pd->end_line =
|
pd->st_line = pd->end_line =
|
||||||
efl_gesture_touch_start_point_get(event);
|
efl_gesture_touch_start_point_get(event);
|
||||||
|
|
||||||
efl_gesture_hotspot_set(gesture, pd->st_line);
|
efl_gesture_hotspot_set(gesture, pd->st_line);
|
||||||
|
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((efl_gesture_touch_cur_timestamp_get(event) - MOMENTUM_TIMEOUT) >
|
if ((efl_gesture_touch_cur_timestamp_get(event) - MOMENTUM_TIMEOUT) >
|
||||||
pd->t_end)
|
pd->t_end)
|
||||||
{
|
{
|
||||||
pd->st_line = efl_gesture_touch_cur_point_get(event);
|
pd->st_line = efl_gesture_touch_cur_point_get(event);
|
||||||
pd->t_st = efl_gesture_touch_cur_timestamp_get(event);
|
pd->t_st = efl_gesture_touch_cur_timestamp_get(event);
|
||||||
pd->xdir = pd->ydir = 0;
|
pd->xdir = pd->ydir = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int xdir, ydir;
|
int xdir, ydir;
|
||||||
Eina_Position2D cur_p = efl_gesture_touch_cur_point_get(event);
|
Eina_Position2D cur_p = efl_gesture_touch_cur_point_get(event);
|
||||||
|
|
||||||
xdir = _direction_get(pd->end_line.x, cur_p.x);
|
xdir = _direction_get(pd->end_line.x, cur_p.x);
|
||||||
ydir = _direction_get(pd->end_line.y, cur_p.y);
|
ydir = _direction_get(pd->end_line.y, cur_p.y);
|
||||||
|
|
||||||
if (xdir && (xdir != pd->xdir))
|
if (xdir && (xdir != pd->xdir))
|
||||||
{
|
{
|
||||||
pd->st_line.x = pd->end_line.x;
|
pd->st_line.x = pd->end_line.x;
|
||||||
pd->t_st = pd->t_end;
|
pd->t_st = pd->t_end;
|
||||||
pd->xdir = xdir;
|
pd->xdir = xdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ydir && (ydir != pd->ydir))
|
if (ydir && (ydir != pd->ydir))
|
||||||
{
|
{
|
||||||
pd->st_line.y = pd->end_line.y;
|
pd->st_line.y = pd->end_line.y;
|
||||||
pd->t_st = pd->t_end;
|
pd->t_st = pd->t_end;
|
||||||
pd->ydir = ydir;
|
pd->ydir = ydir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pd->end_line = efl_gesture_touch_cur_point_get(event);
|
pd->end_line = efl_gesture_touch_cur_point_get(event);
|
||||||
pd->t_end = efl_gesture_touch_cur_timestamp_get(event);
|
pd->t_end = efl_gesture_touch_cur_timestamp_get(event);
|
||||||
efl_gesture_hotspot_set(gesture, pd->end_line);
|
efl_gesture_hotspot_set(gesture, pd->end_line);
|
||||||
|
|
||||||
_momentum_set(obj, md, pd->st_line, efl_gesture_touch_cur_point_get(event),
|
_momentum_set(obj, md, pd->st_line, efl_gesture_touch_cur_point_get(event),
|
||||||
pd->t_st, efl_gesture_touch_cur_timestamp_get(event));
|
pd->t_st, efl_gesture_touch_cur_timestamp_get(event));
|
||||||
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFL_GESTURE_TOUCH_STATE_END:
|
case EFL_GESTURE_TOUCH_STATE_END:
|
||||||
{
|
{
|
||||||
if (!pd->t_st)
|
if (!pd->t_st)
|
||||||
{
|
{
|
||||||
pd->touched = EINA_FALSE;
|
pd->touched = EINA_FALSE;
|
||||||
|
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((efl_gesture_touch_cur_timestamp_get(event) - MOMENTUM_TIMEOUT) > pd->t_end)
|
if ((efl_gesture_touch_cur_timestamp_get(event) - MOMENTUM_TIMEOUT) > pd->t_end)
|
||||||
{
|
{
|
||||||
pd->st_line = efl_gesture_touch_cur_point_get(event);
|
pd->st_line = efl_gesture_touch_cur_point_get(event);
|
||||||
pd->t_st = efl_gesture_touch_cur_timestamp_get(event);
|
pd->t_st = efl_gesture_touch_cur_timestamp_get(event);
|
||||||
pd->xdir = pd->ydir = 0;
|
pd->xdir = pd->ydir = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pd->end_line = efl_gesture_touch_cur_point_get(event);
|
pd->end_line = efl_gesture_touch_cur_point_get(event);
|
||||||
pd->t_end = efl_gesture_touch_cur_timestamp_get(event);
|
pd->t_end = efl_gesture_touch_cur_timestamp_get(event);
|
||||||
efl_gesture_hotspot_set(gesture, pd->end_line);
|
efl_gesture_hotspot_set(gesture, pd->end_line);
|
||||||
|
|
||||||
if ((fabs(md->momentum.x) > EFL_GESTURE_MINIMUM_MOMENTUM) ||
|
if ((fabs(md->momentum.x) > EFL_GESTURE_MINIMUM_MOMENTUM) ||
|
||||||
(fabs(md->momentum.y) > EFL_GESTURE_MINIMUM_MOMENTUM))
|
(fabs(md->momentum.y) > EFL_GESTURE_MINIMUM_MOMENTUM))
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
||||||
else
|
else
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
||||||
|
|
||||||
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Momentum_Data));
|
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Momentum_Data));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "efl_canvas_gesture_private.h"
|
#include "efl_canvas_gesture_private.h"
|
||||||
|
|
||||||
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_TAP_CLASS
|
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_TAP_CLASS
|
||||||
|
|
||||||
//FIXME: It doesnt have matched config value.
|
//FIXME: It doesnt have matched config value.
|
||||||
// may using dobule tap timeout value?
|
// may using dobule tap timeout value?
|
||||||
|
@ -25,7 +25,6 @@ _tap_timeout_cb(void *data)
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EOLIAN static Efl_Canvas_Gesture_Recognizer_Result
|
EOLIAN static Efl_Canvas_Gesture_Recognizer_Result
|
||||||
_efl_canvas_gesture_recognizer_tap_efl_canvas_gesture_recognizer_recognize(Eo *obj,
|
_efl_canvas_gesture_recognizer_tap_efl_canvas_gesture_recognizer_recognize(Eo *obj,
|
||||||
Efl_Canvas_Gesture_Recognizer_Tap_Data *pd,
|
Efl_Canvas_Gesture_Recognizer_Tap_Data *pd,
|
||||||
|
@ -45,44 +44,44 @@ _efl_canvas_gesture_recognizer_tap_efl_canvas_gesture_recognizer_recognize(Eo *o
|
||||||
switch (efl_gesture_touch_state_get(event))
|
switch (efl_gesture_touch_state_get(event))
|
||||||
{
|
{
|
||||||
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
||||||
{
|
{
|
||||||
pos = efl_gesture_touch_start_point_get(event);
|
pos = efl_gesture_touch_start_point_get(event);
|
||||||
efl_gesture_hotspot_set(gesture, pos);
|
efl_gesture_hotspot_set(gesture, pos);
|
||||||
|
|
||||||
if (pd->timeout)
|
if (pd->timeout)
|
||||||
ecore_timer_del(pd->timeout);
|
ecore_timer_del(pd->timeout);
|
||||||
pd->timeout = ecore_timer_add(EFL_GESTURE_RECOGNIZER_TYPE_TAP_TIME_OUT, _tap_timeout_cb, pd);
|
pd->timeout = ecore_timer_add(EFL_GESTURE_RECOGNIZER_TYPE_TAP_TIME_OUT, _tap_timeout_cb, pd);
|
||||||
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
||||||
case EFL_GESTURE_TOUCH_STATE_END:
|
case EFL_GESTURE_TOUCH_STATE_END:
|
||||||
{
|
{
|
||||||
if (pd->timeout)
|
if (pd->timeout)
|
||||||
{
|
{
|
||||||
ecore_timer_del(pd->timeout);
|
ecore_timer_del(pd->timeout);
|
||||||
pd->timeout = NULL;
|
pd->timeout = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
|
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
|
||||||
!efl_gesture_touch_multi_touch_get(event))
|
!efl_gesture_touch_multi_touch_get(event))
|
||||||
{
|
{
|
||||||
dist = efl_gesture_touch_distance(event, 0);
|
dist = efl_gesture_touch_distance(event, 0);
|
||||||
length = fabs(dist.x) + fabs(dist.y);
|
length = fabs(dist.x) + fabs(dist.y);
|
||||||
if (length <= rd->finger_size)
|
if (length <= rd->finger_size)
|
||||||
{
|
{
|
||||||
if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_STATE_END)
|
if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_STATE_END)
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
||||||
else
|
else
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "efl_canvas_gesture_private.h"
|
#include "efl_canvas_gesture_private.h"
|
||||||
|
|
||||||
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_TRIPLE_TAP_CLASS
|
#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_TRIPLE_TAP_CLASS
|
||||||
|
|
||||||
#define TAP_TIME_OUT 0.33
|
#define TAP_TIME_OUT 0.33
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ _efl_canvas_gesture_recognizer_triple_tap_efl_canvas_gesture_recognizer_recogniz
|
||||||
if (!pd->start_timeout)
|
if (!pd->start_timeout)
|
||||||
{
|
{
|
||||||
double time;
|
double time;
|
||||||
Eina_Value *val = efl_gesture_recognizer_config_get(obj, "glayer_doublee_tap_timeout");
|
Eina_Value *val = efl_gesture_recognizer_config_get(obj, "glayer_doublee_tap_timeout");
|
||||||
|
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
|
@ -73,80 +73,64 @@ _efl_canvas_gesture_recognizer_triple_tap_efl_canvas_gesture_recognizer_recogniz
|
||||||
switch (efl_gesture_touch_state_get(event))
|
switch (efl_gesture_touch_state_get(event))
|
||||||
{
|
{
|
||||||
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
||||||
{
|
{
|
||||||
pos = efl_gesture_touch_start_point_get(event);
|
pos = efl_gesture_touch_start_point_get(event);
|
||||||
efl_gesture_hotspot_set(gesture, pos);
|
efl_gesture_hotspot_set(gesture, pos);
|
||||||
|
|
||||||
if (pd->timeout)
|
if (pd->timeout)
|
||||||
ecore_timer_reset(pd->timeout);
|
ecore_timer_reset(pd->timeout);
|
||||||
else
|
else
|
||||||
pd->timeout = ecore_timer_add(timeout, _tap_timeout_cb, obj);
|
pd->timeout = ecore_timer_add(timeout, _tap_timeout_cb, obj);
|
||||||
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
||||||
|
{
|
||||||
|
result = EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
||||||
|
|
||||||
|
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
|
||||||
|
!efl_gesture_touch_multi_touch_get(event))
|
||||||
{
|
{
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
dist = efl_gesture_touch_distance(event, 0);
|
||||||
|
length = fabs(dist.x) + fabs(dist.y);
|
||||||
|
|
||||||
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
|
if (length > rd->finger_size)
|
||||||
!efl_gesture_touch_multi_touch_get(event))
|
|
||||||
{
|
{
|
||||||
dist = efl_gesture_touch_distance(event, 0);
|
if (pd->timeout)
|
||||||
length = fabs(dist.x) + fabs(dist.y);
|
{
|
||||||
|
ecore_timer_del(pd->timeout);
|
||||||
|
pd->timeout = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (length > rd->finger_size)
|
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
||||||
|
|
||||||
|
pd->tap_count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case EFL_GESTURE_TOUCH_STATE_END:
|
||||||
|
{
|
||||||
|
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
|
||||||
|
!efl_gesture_touch_multi_touch_get(event))
|
||||||
|
{
|
||||||
|
dist = efl_gesture_touch_distance(event, 0);
|
||||||
|
length = fabs(dist.x) + fabs(dist.y);
|
||||||
|
|
||||||
|
if (length <= rd->finger_size)
|
||||||
|
{
|
||||||
|
pd->tap_count++;
|
||||||
|
if (pd->tap_count < 3)
|
||||||
{
|
{
|
||||||
if (pd->timeout)
|
if (pd->timeout)
|
||||||
{
|
ecore_timer_reset(pd->timeout);
|
||||||
ecore_timer_del(pd->timeout);
|
|
||||||
pd->timeout = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
|
|
||||||
pd->tap_count = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case EFL_GESTURE_TOUCH_STATE_END:
|
|
||||||
{
|
|
||||||
|
|
||||||
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE &&
|
|
||||||
!efl_gesture_touch_multi_touch_get(event))
|
|
||||||
{
|
|
||||||
dist = efl_gesture_touch_distance(event, 0);
|
|
||||||
length = fabs(dist.x) + fabs(dist.y);
|
|
||||||
|
|
||||||
if (length <= rd->finger_size)
|
|
||||||
{
|
|
||||||
pd->tap_count++;
|
|
||||||
if (pd->tap_count < 3)
|
|
||||||
{
|
|
||||||
if (pd->timeout)
|
|
||||||
ecore_timer_reset(pd->timeout);
|
|
||||||
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (pd->timeout)
|
|
||||||
{
|
|
||||||
ecore_timer_del(pd->timeout);
|
|
||||||
pd->timeout = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_STATE_END)
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
|
||||||
else
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
|
||||||
|
|
||||||
pd->tap_count = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -156,15 +140,31 @@ _efl_canvas_gesture_recognizer_triple_tap_efl_canvas_gesture_recognizer_recogniz
|
||||||
pd->timeout = NULL;
|
pd->timeout = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_STATE_END)
|
||||||
|
result = EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
||||||
|
else
|
||||||
|
result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
|
|
||||||
pd->tap_count = 0;
|
pd->tap_count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pd->timeout)
|
||||||
|
{
|
||||||
|
ecore_timer_del(pd->timeout);
|
||||||
|
pd->timeout = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
||||||
|
|
||||||
|
pd->tap_count = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
|
|
||||||
static Evas_Coord
|
static Evas_Coord
|
||||||
_finger_gap_length_get(Evas_Coord xx1,
|
_finger_gap_length_get(Evas_Coord xx1,
|
||||||
Evas_Coord yy1,
|
Evas_Coord yy1,
|
||||||
Evas_Coord xx2,
|
Evas_Coord xx2,
|
||||||
Evas_Coord yy2,
|
Evas_Coord yy2,
|
||||||
Evas_Coord *x,
|
Evas_Coord *x,
|
||||||
Evas_Coord *y)
|
Evas_Coord *y)
|
||||||
{
|
{
|
||||||
double a, b, xx, yy, gap;
|
double a, b, xx, yy, gap;
|
||||||
xx = abs(xx2 - xx1);
|
xx = abs(xx2 - xx1);
|
||||||
|
@ -67,7 +67,7 @@ _zoom_compute(Efl_Canvas_Gesture_Recognizer_Zoom_Data *pd,
|
||||||
//unsigned int tm_end = (pd->zoom_mv.cur.timestamp > pd->zoom_mv1.cur.timestamp) ?
|
//unsigned int tm_end = (pd->zoom_mv.cur.timestamp > pd->zoom_mv1.cur.timestamp) ?
|
||||||
// pd->zoom_mv.cur.timestamp : pd->zoom_mv1.cur.timestamp;
|
// pd->zoom_mv.cur.timestamp : pd->zoom_mv1.cur.timestamp;
|
||||||
|
|
||||||
int x,y; //Hot spot
|
int x, y; //Hot spot
|
||||||
Evas_Coord diam = _finger_gap_length_get(xx1, yy1, xx2, yy2,
|
Evas_Coord diam = _finger_gap_length_get(xx1, yy1, xx2, yy2,
|
||||||
&x, &y);
|
&x, &y);
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ _zoom_compute(Efl_Canvas_Gesture_Recognizer_Zoom_Data *pd,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pd->zoom_distance_tolerance) /* zoom tolerance <> ZERO, means
|
if (pd->zoom_distance_tolerance) /* zoom tolerance <> ZERO, means
|
||||||
* zoom action NOT started yet */
|
* zoom action NOT started yet */
|
||||||
{
|
{
|
||||||
/* avoid jump with zoom value when break tolerance */
|
/* avoid jump with zoom value when break tolerance */
|
||||||
if (diam < (pd->zoom_base - pd->zoom_distance_tolerance))
|
if (diam < (pd->zoom_base - pd->zoom_distance_tolerance))
|
||||||
|
@ -147,7 +147,7 @@ _efl_canvas_gesture_recognizer_zoom_efl_canvas_gesture_recognizer_recognize(Eo *
|
||||||
else zoom_finger_enable = 1;
|
else zoom_finger_enable = 1;
|
||||||
|
|
||||||
val = efl_gesture_recognizer_config_get(obj, "glayer_zoom_finger_factor");
|
val = efl_gesture_recognizer_config_get(obj, "glayer_zoom_finger_factor");
|
||||||
if (val) eina_value_get(val, &pd->zoom_finger_factor);
|
if (val) eina_value_get(val, &pd->zoom_finger_factor);
|
||||||
else pd->zoom_finger_factor = 1.0;
|
else pd->zoom_finger_factor = 1.0;
|
||||||
|
|
||||||
rd->continues = EINA_TRUE;
|
rd->continues = EINA_TRUE;
|
||||||
|
@ -156,7 +156,7 @@ _efl_canvas_gesture_recognizer_zoom_efl_canvas_gesture_recognizer_recognize(Eo *
|
||||||
{
|
{
|
||||||
pd->calc_temp = EINA_TRUE;
|
pd->calc_temp = EINA_TRUE;
|
||||||
val = efl_gesture_recognizer_config_get(obj, "glayer_zoom_distance_tolerance");
|
val = efl_gesture_recognizer_config_get(obj, "glayer_zoom_distance_tolerance");
|
||||||
if (val) eina_value_get(val, &pd->zoom_distance_tolerance);
|
if (val) eina_value_get(val, &pd->zoom_distance_tolerance);
|
||||||
else pd->zoom_distance_tolerance = 1.0;
|
else pd->zoom_distance_tolerance = 1.0;
|
||||||
|
|
||||||
pd->zoom_distance_tolerance *= rd->finger_size;
|
pd->zoom_distance_tolerance *= rd->finger_size;
|
||||||
|
@ -165,108 +165,109 @@ _efl_canvas_gesture_recognizer_zoom_efl_canvas_gesture_recognizer_recognize(Eo *
|
||||||
switch (efl_gesture_touch_state_get(event))
|
switch (efl_gesture_touch_state_get(event))
|
||||||
{
|
{
|
||||||
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
case EFL_GESTURE_TOUCH_STATE_UPDATE:
|
||||||
{
|
{
|
||||||
if ((!glayer_continues_enable) && (!pd->zoom_st.cur.timestamp))
|
if ((!glayer_continues_enable) && (!pd->zoom_st.cur.timestamp))
|
||||||
{
|
{
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
||||||
}
|
}
|
||||||
EINA_FALLTHROUGH;
|
EINA_FALLTHROUGH;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
case EFL_GESTURE_TOUCH_STATE_BEGIN:
|
||||||
{
|
{
|
||||||
if (td->touch_down > 2)
|
if (td->touch_down > 2)
|
||||||
{
|
{
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pd->zoom_st.cur.timestamp) /* Now scan touched-devices list
|
if (!pd->zoom_st.cur.timestamp) /* Now scan touched-devices list
|
||||||
* and find other finger */
|
* and find other finger */
|
||||||
{
|
{
|
||||||
if (!efl_gesture_touch_multi_touch_get(event))
|
if (!efl_gesture_touch_multi_touch_get(event))
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
|
||||||
|
|
||||||
Pointer_Data *p1 = eina_hash_find(td->touch_points, &id1);
|
|
||||||
Pointer_Data *p2 = eina_hash_find(td->touch_points, &id2);
|
|
||||||
|
|
||||||
memcpy(&pd->zoom_st, p2, sizeof(Pointer_Data));
|
|
||||||
memcpy(&pd->zoom_st1, p1, sizeof(Pointer_Data));
|
|
||||||
|
|
||||||
memcpy(&pd->zoom_mv, p2, sizeof(Pointer_Data));
|
|
||||||
memcpy(&pd->zoom_mv1, p1, sizeof(Pointer_Data));
|
|
||||||
|
|
||||||
int x,y; //Hot spot
|
|
||||||
zd->zoom = 1.0;
|
|
||||||
pd->zoom_base = _finger_gap_length_get(pd->zoom_st1.cur.pos.x,
|
|
||||||
pd->zoom_st1.cur.pos.y,
|
|
||||||
pd->zoom_st.cur.pos.x,
|
|
||||||
pd->zoom_st.cur.pos.y,
|
|
||||||
&x, &y);
|
|
||||||
|
|
||||||
zd->radius = pd->zoom_base / 2.0;
|
|
||||||
|
|
||||||
if ((efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_STARTED) &&
|
|
||||||
(efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_UPDATED))
|
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
|
||||||
|
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Pointer_Data *p2 = eina_hash_find(td->touch_points, &id2);
|
|
||||||
if (p2->id == pd->zoom_mv.id)
|
|
||||||
memcpy(&pd->zoom_mv, p2, sizeof(Pointer_Data));
|
|
||||||
else if (p2->id == pd->zoom_mv1.id)
|
|
||||||
memcpy(&pd->zoom_mv1, p2, sizeof(Pointer_Data));
|
|
||||||
|
|
||||||
zd->zoom = _zoom_compute(pd, zd, pd->zoom_mv.cur.pos.x,
|
|
||||||
pd->zoom_mv.cur.pos.y, pd->zoom_mv1.cur.pos.x,
|
|
||||||
pd->zoom_mv1.cur.pos.y, pd->zoom_finger_factor);
|
|
||||||
|
|
||||||
|
|
||||||
if (!pd->zoom_distance_tolerance)
|
|
||||||
{
|
|
||||||
double d = zd->zoom - pd->next_step;
|
|
||||||
|
|
||||||
if (d < 0.0) d = (-d);
|
|
||||||
|
|
||||||
if (d >= pd->zoom_step)
|
|
||||||
{
|
|
||||||
pd->next_step = zd->zoom;
|
|
||||||
|
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
|
||||||
}
|
|
||||||
case EFL_GESTURE_TOUCH_STATE_END:
|
|
||||||
{
|
|
||||||
if (td->touch_down == 0)
|
|
||||||
{
|
|
||||||
rd->continues = EINA_FALSE;
|
|
||||||
|
|
||||||
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Zoom_Data));
|
|
||||||
efl_gesture_manager_gesture_clean_up(rd->manager, watched, EFL_EVENT_GESTURE_ZOOM);
|
|
||||||
|
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
||||||
}
|
|
||||||
if ((pd->zoom_base) && (pd->zoom_distance_tolerance == 0))
|
|
||||||
{
|
|
||||||
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Zoom_Data));
|
|
||||||
|
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
Pointer_Data *p1 = eina_hash_find(td->touch_points, &id1);
|
||||||
}
|
Pointer_Data *p2 = eina_hash_find(td->touch_points, &id2);
|
||||||
|
|
||||||
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE)
|
memcpy(&pd->zoom_st, p2, sizeof(Pointer_Data));
|
||||||
{
|
memcpy(&pd->zoom_st1, p1, sizeof(Pointer_Data));
|
||||||
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Zoom_Data));
|
|
||||||
|
|
||||||
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
memcpy(&pd->zoom_mv, p2, sizeof(Pointer_Data));
|
||||||
}
|
memcpy(&pd->zoom_mv1, p1, sizeof(Pointer_Data));
|
||||||
}
|
|
||||||
|
int x, y; //Hot spot
|
||||||
|
zd->zoom = 1.0;
|
||||||
|
pd->zoom_base = _finger_gap_length_get(pd->zoom_st1.cur.pos.x,
|
||||||
|
pd->zoom_st1.cur.pos.y,
|
||||||
|
pd->zoom_st.cur.pos.x,
|
||||||
|
pd->zoom_st.cur.pos.y,
|
||||||
|
&x, &y);
|
||||||
|
|
||||||
|
zd->radius = pd->zoom_base / 2.0;
|
||||||
|
|
||||||
|
if ((efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_STARTED) &&
|
||||||
|
(efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_UPDATED))
|
||||||
|
return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
|
|
||||||
|
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pointer_Data *p2 = eina_hash_find(td->touch_points, &id2);
|
||||||
|
if (p2->id == pd->zoom_mv.id)
|
||||||
|
memcpy(&pd->zoom_mv, p2, sizeof(Pointer_Data));
|
||||||
|
else if (p2->id == pd->zoom_mv1.id)
|
||||||
|
memcpy(&pd->zoom_mv1, p2, sizeof(Pointer_Data));
|
||||||
|
|
||||||
|
zd->zoom = _zoom_compute(pd, zd, pd->zoom_mv.cur.pos.x,
|
||||||
|
pd->zoom_mv.cur.pos.y, pd->zoom_mv1.cur.pos.x,
|
||||||
|
pd->zoom_mv1.cur.pos.y, pd->zoom_finger_factor);
|
||||||
|
|
||||||
|
if (!pd->zoom_distance_tolerance)
|
||||||
|
{
|
||||||
|
double d = zd->zoom - pd->next_step;
|
||||||
|
|
||||||
|
if (d < 0.0) d = (-d);
|
||||||
|
|
||||||
|
if (d >= pd->zoom_step)
|
||||||
|
{
|
||||||
|
pd->next_step = zd->zoom;
|
||||||
|
|
||||||
|
return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
||||||
|
}
|
||||||
|
|
||||||
|
case EFL_GESTURE_TOUCH_STATE_END:
|
||||||
|
{
|
||||||
|
if (td->touch_down == 0)
|
||||||
|
{
|
||||||
|
rd->continues = EINA_FALSE;
|
||||||
|
|
||||||
|
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Zoom_Data));
|
||||||
|
efl_gesture_manager_gesture_clean_up(rd->manager, watched, EFL_EVENT_GESTURE_ZOOM);
|
||||||
|
|
||||||
|
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
|
||||||
|
}
|
||||||
|
if ((pd->zoom_base) && (pd->zoom_distance_tolerance == 0))
|
||||||
|
{
|
||||||
|
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Zoom_Data));
|
||||||
|
|
||||||
|
return EFL_GESTURE_RECOGNIZER_RESULT_FINISH;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE)
|
||||||
|
{
|
||||||
|
memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Zoom_Data));
|
||||||
|
|
||||||
|
return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
//that are directed to a particular object from the
|
//that are directed to a particular object from the
|
||||||
//first finger down to the last finger up
|
//first finger down to the last finger up
|
||||||
|
|
||||||
static void _hash_free_cb(Pointer_Data *point)
|
static void
|
||||||
|
_hash_free_cb(Pointer_Data *point)
|
||||||
{
|
{
|
||||||
free(point);
|
free(point);
|
||||||
}
|
}
|
||||||
|
@ -99,11 +100,11 @@ _efl_canvas_gesture_touch_point_record(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_T
|
||||||
}
|
}
|
||||||
point->action = action;
|
point->action = action;
|
||||||
|
|
||||||
if (!id && (action == EFL_POINTER_ACTION_DOWN))
|
if (!id && (action == EFL_POINTER_ACTION_DOWN))
|
||||||
{
|
{
|
||||||
pd->state = EFL_GESTURE_TOUCH_STATE_BEGIN;
|
pd->state = EFL_GESTURE_TOUCH_STATE_BEGIN;
|
||||||
}
|
}
|
||||||
else if (action == EFL_POINTER_ACTION_UP)
|
else if (action == EFL_POINTER_ACTION_UP)
|
||||||
{
|
{
|
||||||
pd->state = EFL_GESTURE_TOUCH_STATE_END;
|
pd->state = EFL_GESTURE_TOUCH_STATE_END;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue