fix (scroll) do not send unnecessary scroll end events
This commit is contained in:
@@ -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 {
|
} else {
|
||||||
/*Remove pending animations*/
|
/*Remove pending animations*/
|
||||||
lv_res_t res;
|
bool y_del = lv_anim_del(obj, scroll_y_anim);
|
||||||
res = lv_event_send(obj, LV_EVENT_SCROLL_END, NULL);
|
bool x_del = lv_anim_del(obj, scroll_x_anim);
|
||||||
if(res != LV_RES_OK) return;
|
|
||||||
lv_anim_del(obj, scroll_y_anim);
|
|
||||||
lv_anim_del(obj, scroll_x_anim);
|
|
||||||
scroll_by_raw(obj, x, y);
|
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.*/
|
/*Remove any pending scroll animations.*/
|
||||||
lv_res_t res;
|
bool y_del = lv_anim_del(parent, scroll_y_anim);
|
||||||
res = lv_event_send(parent, LV_EVENT_SCROLL_END, NULL);
|
bool x_del = lv_anim_del(parent, scroll_x_anim);
|
||||||
if(res != LV_RES_OK) return;
|
if(y_del || x_del) {
|
||||||
lv_anim_del(parent, scroll_x_anim);
|
lv_res_t res;
|
||||||
lv_anim_del(parent, scroll_y_anim);
|
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_LEFT) == 0 && x_scroll < 0) x_scroll = 0;
|
||||||
if((scroll_dir & LV_DIR_RIGHT) == 0 && x_scroll > 0) x_scroll = 0;
|
if((scroll_dir & LV_DIR_RIGHT) == 0 && x_scroll > 0) x_scroll = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user