Fix release drag hoping better checking for -1 last drag x
@@ -332,9 +332,13 @@ 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);
- lv_coord_t drag_x_diff = p.x - ext->last_drag_x;
+ 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;
ext->last_drag_x = p.x;
+
if (ext->knob_area.y1 < p.y && p.y < ext->knob_area.y2) {
if (drag_x_diff > 0 && p.x < ext->knob_area.x2) {
lv_rotary_set_value(rotary, lv_rotary_get_value(rotary) + drag_x_diff * ext->sensitivity, LV_ANIM_ON);
@@ -348,10 +352,11 @@ 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) */
