mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-29 06:36:05 +08:00
fix sending of DRAG_BEGIN/END siganls and events
This commit is contained in:
+12
-10
@@ -1106,20 +1106,12 @@ static void indev_drag(lv_indev_proc_t * state)
|
|||||||
lv_obj_set_y(drag_obj, act_y + state->types.pointer.vect.y);
|
lv_obj_set_y(drag_obj, act_y + state->types.pointer.vect.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Set the drag in progress flag*/
|
|
||||||
/*Send the drag begin signal on first move*/
|
|
||||||
if(state->types.pointer.drag_in_prog == 0) {
|
|
||||||
drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_BEGIN, indev_act);
|
|
||||||
if(indev_reset_check(state)) return;
|
|
||||||
lv_event_send(drag_obj, LV_EVENT_DRAG_BEGIN, NULL);
|
|
||||||
if(indev_reset_check(state)) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
state->types.pointer.drag_in_prog = 1;
|
|
||||||
|
|
||||||
/*If the object didn't moved then clear the invalidated areas*/
|
/*If the object didn't moved then clear the invalidated areas*/
|
||||||
if(drag_obj->coords.x1 == prev_x && drag_obj->coords.y1 == prev_y) {
|
if(drag_obj->coords.x1 == prev_x && drag_obj->coords.y1 == prev_y) {
|
||||||
state->types.pointer.drag_in_prog = 0;
|
// state->types.pointer.drag_in_prog = 0;
|
||||||
/*In a special case if the object is moved on a page and
|
/*In a special case if the object is moved on a page and
|
||||||
* the scrollable has fit == true and the object is dragged of the page then
|
* the scrollable has fit == true and the object is dragged of the page then
|
||||||
* while its coordinate is not changing only the parent's size is reduced */
|
* while its coordinate is not changing only the parent's size is reduced */
|
||||||
@@ -1129,6 +1121,16 @@ static void indev_drag(lv_indev_proc_t * state)
|
|||||||
uint16_t new_inv_buf_size = lv_disp_get_inv_buf_size(indev_act->driver.disp);
|
uint16_t new_inv_buf_size = lv_disp_get_inv_buf_size(indev_act->driver.disp);
|
||||||
lv_disp_pop_from_inv_buf(indev_act->driver.disp, new_inv_buf_size - inv_buf_size);
|
lv_disp_pop_from_inv_buf(indev_act->driver.disp, new_inv_buf_size - inv_buf_size);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
state->types.pointer.drag_in_prog = 1;
|
||||||
|
/*Set the drag in progress flag*/
|
||||||
|
/*Send the drag begin signal on first move*/
|
||||||
|
if(drag_just_started) {
|
||||||
|
drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_BEGIN, indev_act);
|
||||||
|
if(indev_reset_check(state)) return;
|
||||||
|
lv_event_send(drag_obj, LV_EVENT_DRAG_BEGIN, NULL);
|
||||||
|
if(indev_reset_check(state)) return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user