fix(indev) provide raw old points to read_cb, not rotated points (#2180)
cherry-picked from acf42d39
This commit is contained in:
committed by
Gabor Kiss-Vamosi
parent
194f893bd7
commit
d2baa9c3e2
@@ -325,6 +325,10 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
|
|||||||
static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
|
static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||||
{
|
{
|
||||||
lv_disp_t *disp = i->driver->disp;
|
lv_disp_t *disp = i->driver->disp;
|
||||||
|
/*Save the raw points so they can be used again in _lv_indev_read*/
|
||||||
|
i->proc.types.pointer.last_raw_point.x = data->point.x;
|
||||||
|
i->proc.types.pointer.last_raw_point.y = data->point.y;
|
||||||
|
|
||||||
if(disp->driver->rotated == LV_DISP_ROT_180 || disp->driver->rotated == LV_DISP_ROT_270) {
|
if(disp->driver->rotated == LV_DISP_ROT_180 || disp->driver->rotated == LV_DISP_ROT_270) {
|
||||||
data->point.x = disp->driver->hor_res - data->point.x - 1;
|
data->point.x = disp->driver->hor_res - data->point.x - 1;
|
||||||
data->point.y = disp->driver->ver_res - data->point.y - 1;
|
data->point.y = disp->driver->ver_res - data->point.y - 1;
|
||||||
|
|||||||
@@ -135,11 +135,11 @@ bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
|
|||||||
|
|
||||||
lv_memset_00(data, sizeof(lv_indev_data_t));
|
lv_memset_00(data, sizeof(lv_indev_data_t));
|
||||||
|
|
||||||
/*For touchpad sometimes users don't set the last pressed coordinate on release.
|
/* For touchpad sometimes users don't set the last pressed coordinate on release.
|
||||||
*So be sure a coordinates are initialized to the last point*/
|
* So be sure a coordinates are initialized to the last point */
|
||||||
if(indev->driver->type == LV_INDEV_TYPE_POINTER) {
|
if(indev->driver->type == LV_INDEV_TYPE_POINTER) {
|
||||||
data->point.x = indev->proc.types.pointer.act_point.x;
|
data->point.x = indev->proc.types.pointer.last_raw_point.x;
|
||||||
data->point.y = indev->proc.types.pointer.act_point.y;
|
data->point.y = indev->proc.types.pointer.last_raw_point.y;
|
||||||
}
|
}
|
||||||
/*Similarly set at least the last key in case of the user doesn't set it on release*/
|
/*Similarly set at least the last key in case of the user doesn't set it on release*/
|
||||||
else if(indev->driver->type == LV_INDEV_TYPE_KEYPAD) {
|
else if(indev->driver->type == LV_INDEV_TYPE_KEYPAD) {
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ typedef struct _lv_indev_proc_t {
|
|||||||
/*Pointer and button data*/
|
/*Pointer and button data*/
|
||||||
lv_point_t act_point; /**< Current point of input device.*/
|
lv_point_t act_point; /**< Current point of input device.*/
|
||||||
lv_point_t last_point; /**< Last point of input device.*/
|
lv_point_t last_point; /**< Last point of input device.*/
|
||||||
|
lv_point_t last_raw_point; /**< Last point read from read_cb. */
|
||||||
lv_point_t vect; /**< Difference between `act_point` and `last_point`.*/
|
lv_point_t vect; /**< Difference between `act_point` and `last_point`.*/
|
||||||
lv_point_t scroll_sum; /*Count the dragged pixels to check LV_INDEV_DEF_SCROLL_LIMIT*/
|
lv_point_t scroll_sum; /*Count the dragged pixels to check LV_INDEV_DEF_SCROLL_LIMIT*/
|
||||||
lv_point_t scroll_throw_vect;
|
lv_point_t scroll_throw_vect;
|
||||||
|
|||||||
Reference in New Issue
Block a user