mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fix (scroll) do not send unnecessary scroll end events
This commit is contained in:
parent
25acaf45ca
commit
3ce5226c9d
@ -289,12 +289,14 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable
|
||||
}
|
||||
} else {
|
||||
/*Remove pending animations*/
|
||||
lv_res_t res;
|
||||
res = lv_event_send(obj, LV_EVENT_SCROLL_END, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
lv_anim_del(obj, scroll_y_anim);
|
||||
lv_anim_del(obj, scroll_x_anim);
|
||||
bool y_del = lv_anim_del(obj, scroll_y_anim);
|
||||
bool x_del = lv_anim_del(obj, scroll_x_anim);
|
||||
scroll_by_raw(obj, x, y);
|
||||
if(y_del || x_del) {
|
||||
lv_res_t res;
|
||||
res = lv_event_send(obj, LV_EVENT_SCROLL_END, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -700,11 +702,13 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
|
||||
}
|
||||
|
||||
/*Remove any pending scroll animations.*/
|
||||
lv_res_t res;
|
||||
res = lv_event_send(parent, LV_EVENT_SCROLL_END, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
lv_anim_del(parent, scroll_x_anim);
|
||||
lv_anim_del(parent, scroll_y_anim);
|
||||
bool y_del = lv_anim_del(parent, scroll_y_anim);
|
||||
bool x_del = lv_anim_del(parent, scroll_x_anim);
|
||||
if(y_del || x_del) {
|
||||
lv_res_t res;
|
||||
res = lv_event_send(parent, LV_EVENT_SCROLL_END, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
}
|
||||
|
||||
if((scroll_dir & LV_DIR_LEFT) == 0 && x_scroll < 0) x_scroll = 0;
|
||||
if((scroll_dir & LV_DIR_RIGHT) == 0 && x_scroll > 0) x_scroll = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user