diff --git a/src/extra/widgets/chart/lv_chart.c b/src/extra/widgets/chart/lv_chart.c index 4f1e0fe0dd..a524e1f2fc 100644 --- a/src/extra/widgets/chart/lv_chart.c +++ b/src/extra/widgets/chart/lv_chart.c @@ -1325,7 +1325,8 @@ static void draw_cursors(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx) cy += obj->coords.y1; lv_area_t point_area; - if(point_w && point_h) { + bool draw_point = point_w && point_h; + if(draw_point) { point_area.x1 = cx - point_w; point_area.x2 = cx + point_w; point_area.y1 = cy - point_h; @@ -1345,7 +1346,11 @@ static void draw_cursors(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx) lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_draw_dsc); lv_draw_line(draw_ctx, &line_dsc_tmp, &p1, &p2); - lv_draw_rect(draw_ctx, &point_dsc_tmp, &point_area); + + if(draw_point) { + lv_draw_rect(draw_ctx, &point_dsc_tmp, &point_area); + } + lv_event_send(obj, LV_EVENT_DRAW_PART_END, &part_draw_dsc); } @@ -1357,7 +1362,11 @@ static void draw_cursors(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx) lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_draw_dsc); lv_draw_line(draw_ctx, &line_dsc_tmp, &p1, &p2); - lv_draw_rect(draw_ctx, &point_dsc_tmp, &point_area); + + if(draw_point) { + lv_draw_rect(draw_ctx, &point_dsc_tmp, &point_area); + } + lv_event_send(obj, LV_EVENT_DRAW_PART_END, &part_draw_dsc); } }