fix(indev) provide raw old points to read_cb, not rotated points (#2180)
This commit is contained in:
@@ -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)
|
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;
|
||||||
|
/*Rotate the points if necessary*/
|
||||||
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;
|
||||||
|
|||||||
@@ -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.
|
/* For touchpad sometimes users don't 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) {
|
||||||
|
|||||||
@@ -131,6 +131,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 drag_sum; /*Count the dragged pixels to check LV_INDEV_DEF_DRAG_LIMIT*/
|
lv_point_t drag_sum; /*Count the dragged pixels to check LV_INDEV_DEF_DRAG_LIMIT*/
|
||||||
lv_point_t drag_throw_vect;
|
lv_point_t drag_throw_vect;
|
||||||
|
|||||||
Reference in New Issue
Block a user