Skip to content

Commit

Permalink
fix(chart) invalidation with LV_CHART_UPDATE_MODE_SHIFT
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Jun 16, 2021
1 parent 31ab062 commit d61617c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/extra/widgets/chart/lv_chart.c
Original file line number Diff line number Diff line change
@@ -1559,8 +1559,17 @@ static void invalidate_point(lv_obj_t * obj, uint16_t i)

lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8;
lv_coord_t scroll_left = lv_obj_get_scroll_left(obj);

/*In shift mode the whole chart changes so the whole object*/
if(chart->update_mode == LV_CHART_UPDATE_MODE_SHIFT) {
lv_obj_invalidate(obj);
return;
}

if(chart->type == LV_CHART_TYPE_LINE) {
lv_coord_t x_ofs = obj->coords.x1 + lv_obj_get_style_pad_left(obj, LV_PART_MAIN) - scroll_left;
lv_coord_t bwidth = lv_obj_get_style_border_width(obj, LV_PART_MAIN);
lv_coord_t pleft = lv_obj_get_style_pad_left(obj, LV_PART_MAIN);
lv_coord_t x_ofs = obj->coords.x1 + pleft + bwidth - scroll_left;
lv_coord_t line_width = lv_obj_get_style_line_width(obj, LV_PART_ITEMS);
lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR);

0 comments on commit d61617c

Please sign in to comment.