fix(table): refresh only the changed cell's height
This commit is contained in:
@@ -13,7 +13,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
|
||||
|
||||
lv_draw_rect_dsc_t rect_dsc;
|
||||
lv_draw_rect_dsc_init(&rect_dsc);
|
||||
rect_dsc.bg_color = chk ? lv_color_green() : lv_color_grey_lighten_2();
|
||||
rect_dsc.bg_color = chk ? lv_theme_get_color_primary(obj) : lv_color_grey_lighten_2();
|
||||
rect_dsc.radius = LV_RADIUS_CIRCLE;
|
||||
|
||||
lv_area_t sw_area;
|
||||
|
||||
@@ -172,7 +172,20 @@ void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint16_t row, uint16_t col, con
|
||||
va_end(ap2);
|
||||
|
||||
table->cell_data[cell][0] = ctrl;
|
||||
refr_size(obj, row);
|
||||
|
||||
/*Refresh the row height*/
|
||||
lv_coord_t cell_left = lv_obj_get_style_pad_left(obj, LV_PART_ITEMS);
|
||||
lv_coord_t cell_right = lv_obj_get_style_pad_right(obj, LV_PART_ITEMS);
|
||||
lv_coord_t cell_top = lv_obj_get_style_pad_top(obj, LV_PART_ITEMS);
|
||||
lv_coord_t cell_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_ITEMS);
|
||||
|
||||
lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_ITEMS);
|
||||
lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_ITEMS);
|
||||
const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_ITEMS);
|
||||
|
||||
table->row_h[row] = get_row_height(obj, row, font, letter_space, line_space,
|
||||
cell_left, cell_right, cell_top, cell_bottom);
|
||||
|
||||
}
|
||||
|
||||
void lv_table_set_row_cnt(lv_obj_t * obj, uint16_t row_cnt)
|
||||
|
||||
Reference in New Issue
Block a user