diff --git a/src/lv_core/lv_indev.c b/src/lv_core/lv_indev.c index a58ea3937..6f4b34ca8 100644 --- a/src/lv_core/lv_indev.c +++ b/src/lv_core/lv_indev.c @@ -414,6 +414,10 @@ lv_task_t * lv_indev_get_read_task(lv_disp_t * indev) static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data) { 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; + /*Rotate the points if necessary*/ 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.y = disp->driver.ver_res - data->point.y - 1; diff --git a/src/lv_hal/lv_hal_indev.c b/src/lv_hal/lv_hal_indev.c index aa706684b..f169ef13c 100644 --- a/src/lv_hal/lv_hal_indev.c +++ b/src/lv_hal/lv_hal_indev.c @@ -132,8 +132,8 @@ bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data) /* For touchpad sometimes users don't the last pressed coordinate on release. * So be sure a coordinates are initialized to the last point */ if(indev->driver.type == LV_INDEV_TYPE_POINTER) { - data->point.x = indev->proc.types.pointer.act_point.x; - data->point.y = indev->proc.types.pointer.act_point.y; + data->point.x = indev->proc.types.pointer.last_raw_point.x; + 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*/ else if(indev->driver.type == LV_INDEV_TYPE_KEYPAD) { diff --git a/src/lv_hal/lv_hal_indev.h b/src/lv_hal/lv_hal_indev.h index cb559f694..7e6c865d6 100644 --- a/src/lv_hal/lv_hal_indev.h +++ b/src/lv_hal/lv_hal_indev.h @@ -131,6 +131,7 @@ typedef struct _lv_indev_proc_t { /*Pointer and button data*/ lv_point_t act_point; /**< Current 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 drag_sum; /*Count the dragged pixels to check LV_INDEV_DEF_DRAG_LIMIT*/ lv_point_t drag_throw_vect;