1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00

Test sensitivity threshold for value jumping

This commit is contained in:
Adam Martini 2020-06-20 23:58:03 -07:00
parent ad990994d0
commit 856368284e

View File

@ -332,11 +332,12 @@ static lv_res_t lv_rotary_signal(lv_obj_t * rotary, lv_signal_t sign, void * par
}
else if(sign == LV_SIGNAL_PRESSING) {
lv_indev_get_point(param, &p);
if (ext->last_drag_x == -1) {
ext->last_drag_x = p.x;
} else {
lv_coord_t drag_x_diff = p.x -ext->last_drag_x;
if (abs(drag_x_diff) > abs(ext->sensitivity)) {
if (drag_x_diff > 0) drag_x_diff = ext->sensitivity;
else drag_x_diff = -ext->sensitivity;
}
ext->last_drag_x = p.x;
if (ext->knob_area.y1 < p.y && p.y < ext->knob_area.y2) {
@ -352,11 +353,10 @@ static lv_res_t lv_rotary_signal(lv_obj_t * rotary, lv_signal_t sign, void * par
if(res != LV_RES_OK) return res;
}
}
}
}
else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
ext->dragging = false;
ext->last_drag_x = -1; /** Reset drag diff calc */
#if LV_USE_GROUP
/*Leave edit mode if released. (No need to wait for LONG_PRESS) */