diff --git a/src/extra/layouts/flex/lv_flex.c b/src/extra/layouts/flex/lv_flex.c index 51ee161c2f..0f43e345e9 100644 --- a/src/extra/layouts/flex/lv_flex.c +++ b/src/extra/layouts/flex/lv_flex.c @@ -146,8 +146,9 @@ static void flex_update(lv_obj_t * cont, void * user_data) lv_coord_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); lv_coord_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN); - if((f.row && h_set == LV_SIZE_CONTENT) || - (!f.row && w_set == LV_SIZE_CONTENT)) + /*Content sized objects should squeezed the gap between the children, therefore any alignment will look like `START`*/ + if((f.row && h_set == LV_SIZE_CONTENT && cont->h_layout == 0) || + (!f.row && w_set == LV_SIZE_CONTENT && cont->w_layout == 0)) { track_cross_place = LV_FLEX_ALIGN_START; } diff --git a/src/extra/layouts/grid/lv_grid.c b/src/extra/layouts/grid/lv_grid.c index 28ef715619..ca7e3a15f9 100644 --- a/src/extra/layouts/grid/lv_grid.c +++ b/src/extra/layouts/grid/lv_grid.c @@ -207,11 +207,11 @@ static void calc(struct _lv_obj_t * cont, _lv_grid_calc_t * calc_out) lv_coord_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); lv_coord_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN); - bool auto_w = w_set == LV_SIZE_CONTENT ? true : false; + bool auto_w = (w_set == LV_SIZE_CONTENT && !cont->w_layout) ? true : false; lv_coord_t cont_w = lv_obj_get_content_width(cont); calc_out->grid_w = grid_align(cont_w, auto_w, get_grid_col_align(cont), col_gap, calc_out->col_num, calc_out->w, calc_out->x, rev); - bool auto_h = h_set == LV_SIZE_CONTENT ? true : false; + bool auto_h = (h_set == LV_SIZE_CONTENT && !cont->h_layout) ? true : false; lv_coord_t cont_h = lv_obj_get_content_height(cont); calc_out->grid_h = grid_align(cont_h, auto_h, get_grid_row_align(cont), row_gap, calc_out->row_num, calc_out->h, calc_out->y, false);