Canvas doesn't draw between two close events (such as LV_EVENT_PRESSING)

I’m trying to draw on canvas during the user is pressing on button, such as every PRESSING event changes the picture. But I cannot see the change until the button is unpressed.
This is my code:

int x;
lv_obj_t * canvas;
static lv_style_t * style;
// Assume all these are properly initialized and event handler set on some button existing on the screen

static void event_handler(lv_obj_t * btn, lv_event_t event)

    lv_canvas_fill_bg(canvas, LV_COLOR_WHITE);

    style.line.width = 2;
    style.line.color = LV_COLOR_BLACK;
    const lv_point_t  test_points[] = { { x, 0 }, {x, 100 } };
    lv_canvas_draw_line(canvas, test_points1, 2, &style);



Is it a bug or maybe indeed the library does not support such “dynamic” redrawing?

Sorry, just needed to call lv_canvas_invalidate.

1 Like