fix(scroll) fix snapping if an object is has LV_OBJ_FLAG_FLOAT

This commit is contained in:
Gabor Kiss-Vamosi
2021-05-14 15:36:33 +02:00
parent f9ca3900f5
commit 9b647dc919
2 changed files with 3 additions and 1 deletions

View File

@@ -422,6 +422,7 @@ static lv_coord_t find_snap_point_x(const lv_obj_t * obj, lv_coord_t min, lv_coo
uint32_t i; uint32_t i;
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) { for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
lv_obj_t * child = lv_obj_get_child(obj, i); lv_obj_t * child = lv_obj_get_child(obj, i);
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
if(lv_obj_has_flag(child, LV_OBJ_FLAG_SNAPABLE)) { if(lv_obj_has_flag(child, LV_OBJ_FLAG_SNAPABLE)) {
lv_coord_t x_child = 0; lv_coord_t x_child = 0;
lv_coord_t x_parent = 0; lv_coord_t x_parent = 0;
@@ -475,6 +476,7 @@ static lv_coord_t find_snap_point_y(const lv_obj_t * obj, lv_coord_t min, lv_coo
uint32_t i; uint32_t i;
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) { for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
lv_obj_t * child = lv_obj_get_child(obj, i); lv_obj_t * child = lv_obj_get_child(obj, i);
if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue;
if(lv_obj_has_flag(child, LV_OBJ_FLAG_SNAPABLE)) { if(lv_obj_has_flag(child, LV_OBJ_FLAG_SNAPABLE)) {
lv_coord_t y_child = 0; lv_coord_t y_child = 0;
lv_coord_t y_parent = 0; lv_coord_t y_parent = 0;

View File

@@ -29,7 +29,7 @@ struct _lv_obj_t;
typedef enum { typedef enum {
LV_DRAW_RES_COVER, /**< Returned on `LV_DRAW_COVER_CHK` if the areas is fully covered*/ LV_DRAW_RES_COVER, /**< Returned on `LV_DRAW_COVER_CHK` if the areas is fully covered*/
LV_DRAW_RES_NOT_COVER, /**< Returned on `LV_DRAW_COVER_CHK` if the areas is not covered*/ LV_DRAW_RES_NOT_COVER, /**< Returned on `LV_DRAW_COVER_CHK` if the areas is not covered*/
LV_DRAW_RES_MASKED, /**< Returned on `LV_DRAW_COVER_CHK` if the areas is masked out (children also not cover)*/ LV_DRAW_RES_MASKED, /**< Returned on `LV_DRAW_COVER_CHK` if the areas is masked out*/
}lv_draw_res_t; }lv_draw_res_t;
typedef struct typedef struct