lv_indev_gesture.h
Typedefs
-
typedef struct lv_indev_gesture_recognizer lv_indev_gesture_recognizer_t
-
typedef struct lv_indev_touch_data lv_indev_touch_data_t
-
typedef struct lv_indev_gesture lv_indev_gesture_t
-
typedef struct lv_indev_gesture_configuration lv_indev_gesture_configuration_t
-
typedef void (*lv_recognizer_func_t)(lv_indev_gesture_recognizer_t*, lv_indev_touch_data_t*, uint16_t)
Enums
Functions
-
void lv_indev_gesture_detect_pinch(lv_indev_gesture_recognizer_t *recognizer, lv_indev_touch_data_t *touches, uint16_t touch_cnt)
Pinch gesture recognizer function Will update the recognizer data
- Parameters:
recognizer – pointer to a gesture recognizer
touches – pointer to the first element of the collected touch events
touch_cnt – length of passed touch event array.
-
void lv_indev_gesture_detect_rotation(lv_indev_gesture_recognizer_t *recognizer, lv_indev_touch_data_t *touches, uint16_t touch_cnt)
Rotation gesture recognizer function Will update the recognizer data
- Parameters:
recognizer – pointer to a gesture recognizer
touches – pointer to the first element of the collected touch events
touch_cnt – length of passed touch event array.
-
void lv_indev_gesture_detect_two_fingers_swipe(lv_indev_gesture_recognizer_t *recognizer, lv_indev_touch_data_t *touches, uint16_t touch_cnt)
Two finger swipe gesture recognizer function Will update the recognizer data
- Parameters:
recognizer – pointer to a gesture recognizer
touches – pointer to the first element of the collected touch events
touch_cnt – length of passed touch event array.
-
void lv_indev_set_pinch_up_threshold(lv_indev_t *indev, float threshold)
Set the threshold for the pinch gesture scale up, when the scale factor of gesture reaches the threshold events get sent
- Parameters:
indev – pointer to the indev device containing the pinch recognizer
threshold – threshold for a pinch up gesture to be recognized
-
void lv_indev_set_pinch_down_threshold(lv_indev_t *indev, float threshold)
Set the threshold for the pinch gesture scale down, when the scale factor of gesture reaches the threshold events get sent
- Parameters:
indev – pointer to the indev device containing the pinch recognizer
threshold – threshold for a pinch down gesture to be recognized
-
void lv_indev_set_rotation_rad_threshold(lv_indev_t *indev, float threshold)
Set the rotation threshold in radian for the rotation gesture
- Parameters:
indev – pointer to the indev device containing the rotation recognizer
threshold – threshold in radian for a rotation gesture to be recognized
-
float lv_event_get_pinch_scale(lv_event_t *gesture_event)
Obtains the current scale of a pinch gesture
- Parameters:
gesture_event – pointer to a gesture event
- Returns:
the scale of the current gesture
-
float lv_event_get_rotation(lv_event_t *gesture_event)
Obtains the current angle in radian of a rotation gesture
- Parameters:
gesture_event – pointer to a gesture event
- Returns:
the rotation angle in radian of the current gesture
-
float lv_event_get_two_fingers_swipe_distance(lv_event_t *gesture_event)
Obtains the current distance in pixels of a two fingers swipe gesture, from the starting center
- Parameters:
gesture_event – pointer to a gesture event
- Returns:
the distance from the center, in pixels, of the current gesture
-
lv_dir_t lv_event_get_two_fingers_swipe_dir(lv_event_t *gesture_event)
Obtains the current direction from the center of a two finger swipe
- Parameters:
gesture_event – pointer to a gesture event
- Returns:
the rotation angle in radian of the current gesture
-
void lv_indev_set_gesture_data(lv_indev_data_t *data, lv_indev_gesture_recognizer_t *recognizer, lv_indev_gesture_type_t type)
Sets the state of the recognizer to a indev data structure, it is usually called from the indev read callback
- Parameters:
data – the indev data
recognizer – pointer to a gesture recognizer
-
void lv_indev_get_gesture_center_point(lv_indev_gesture_recognizer_t *recognizer, lv_point_t *point)
Obtains the center point of a gesture
- Parameters:
gesture_event – pointer to a gesture recognizer event
point – pointer to a point
-
lv_indev_gesture_state_t lv_event_get_gesture_state(lv_event_t *gesture_event, lv_indev_gesture_type_t type)
Obtains the current state of the gesture recognizer attached to an event
- Parameters:
gesture_event – pointer to a gesture recognizer event
- Returns:
current state of the gesture recognizer
-
lv_indev_gesture_type_t lv_event_get_gesture_type(lv_event_t *gesture_event)
Obtains the current event type of the gesture recognizer attached to an event
- Parameters:
gesture_event – pointer to a gesture recognizer event
- Returns:
current event type of the gesture recognizer
-
void lv_indev_get_gesture_primary_point(lv_indev_gesture_recognizer_t *recognizer, lv_point_t *point)
Obtains the coordinates of the current primary point
- Parameters:
recognizer – pointer to a gesture recognizer
point – pointer to a point
-
bool lv_indev_recognizer_is_active(lv_indev_gesture_recognizer_t *recognizer)
Allows to determine if there is an are ongoing gesture
- Parameters:
recognizer – pointer to a gesture recognizer
- Returns:
false if there are no contact points, or the gesture has ended - true otherwise
-
void lv_indev_gesture_recognizers_update(lv_indev_t *indev, lv_indev_touch_data_t *touches, uint16_t touch_cnt)
Update the recognizers. It execute the recognizers functions and checks for LV_GESTURE_STATE_RECOGNIZED or LV_GESTURE_STATE_ENDED gestures. To be called in the indev read_cb.
- Parameters:
indev – pointer to the indev containing from which the reconizer need an update
touches – indev touch data array, containing the last touch data from indev since the last recognizers update
touch_cnt – number of indev touch data in touches
-
void lv_indev_gesture_recognizers_set_data(lv_indev_t *indev, lv_indev_data_t *data)
Set the lv_indev_data_t struct from the recognizer data. To be called in the indev read_cb.
-
struct lv_indev_touch_data
-
struct lv_indev_gesture_recognizer
Public Members
-
lv_indev_gesture_t *info
-
float scale
-
float rotation
-
float distance
-
float speed
-
lv_recognizer_func_t recog_fn
-
lv_indev_gesture_t *info