efl/gesture: add 'pressed' state info for touch data
since we retain touch info for the duration of a touch sequence, including after a touch point has been unpressed, it's necessary to track the current state of each point and then use that to accurately determine the number of touches active Reviewed-by: woochan lee <wc0917.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D11168
This commit is contained in:
parent
0bb36d23e2
commit
bf0fe4a800
|
@ -56,14 +56,16 @@ _efl_canvas_gesture_touch_point_record(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_T
|
|||
|
||||
if (action == EFL_POINTER_ACTION_DOWN)
|
||||
{
|
||||
pd->touch_down++;
|
||||
if ((!point) || (!point->cur.pressed))
|
||||
pd->touch_down++;
|
||||
if (pd->touch_down >= 2)
|
||||
pd->multi_touch = EINA_TRUE;
|
||||
}
|
||||
else if ((action == EFL_POINTER_ACTION_UP) ||
|
||||
(action == EFL_POINTER_ACTION_CANCEL))
|
||||
{
|
||||
pd->touch_down--;
|
||||
if (point && point->cur.pressed)
|
||||
pd->touch_down--;
|
||||
if (pd->multi_touch && pd->touch_down == 1)
|
||||
pd->multi_touch = EINA_FALSE;
|
||||
}
|
||||
|
@ -100,16 +102,19 @@ _efl_canvas_gesture_touch_point_record(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_T
|
|||
|
||||
if (!id && (action == EFL_POINTER_ACTION_DOWN))
|
||||
{
|
||||
point->cur.pressed = EINA_TRUE;
|
||||
pd->state = EFL_GESTURE_TOUCH_STATE_BEGIN;
|
||||
}
|
||||
else if (action == EFL_POINTER_ACTION_UP)
|
||||
{
|
||||
point->cur.pressed = EINA_FALSE;
|
||||
pd->state = EFL_GESTURE_TOUCH_STATE_END;
|
||||
}
|
||||
else
|
||||
{
|
||||
pd->state = EFL_GESTURE_TOUCH_STATE_UPDATE;
|
||||
}
|
||||
point->cur.pressed |= action == EFL_POINTER_ACTION_DOWN || action == EFL_POINTER_ACTION_MOVE;
|
||||
return;
|
||||
|
||||
finished_touch:
|
||||
|
|
|
@ -51,6 +51,7 @@ enum @beta Efl.Canvas.Gesture_Recognizer_Type
|
|||
struct @beta @c_name(Efl_Gesture_Touch_Point_Info) Efl.Canvas.Gesture_Touch_Point_Info {
|
||||
[[This struct represents the underlying data of a touch point.]]
|
||||
pos: Eina.Position2D; [[The canvas position of the touch point data.]]
|
||||
pressed: bool; [[Whether this touch point is being pressed down.]]
|
||||
timestamp: uint; [[The timestamp of the touch point data.]]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue