How can i fix drag and drop issues


if the size of the object, in my case LED, is less than 20x20, dragging becomes problematic

What MCU/Processor/Board and compiler are you using?


What LVGL version are you using?


What do you want to achieve?

What have you tried so far?

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

  lv_obj_t * led1  = lv_led_create(lv_scr_act(), NULL);
    lv_obj_set_size(led1, 20, 20);
    lv_obj_set_style_local_bg_color(led1,LV_LED_PART_MAIN, LV_STATE_DEFAULT,LV_COLOR_RED);
    lv_obj_align(led1, NULL, LV_ALIGN_IN_TOP_LEFT, x_pos, y_pos);
    lv_led_set_bright(led1, 255);

void event_task(lv_obj_t * obj, lv_event_t event){
    if (event == LV_EVENT_PRESSING){
        lv_obj_set_drag (obj, true);
    else if(event == LV_EVENT_CLICKED) {

Screenshot and/or video

original video
2020-12-03 (1.4 MB)

at the end I changed the size to 10x10, it was no longer possible to drag

Applying an extended click area worked for me. Like this lv_obj_set_ext_click_area(led1,10,10,10,10);
You can of course change the size of the area but 10 pixels all round worked for me and i had no problem dragging an 10x10 led.

I forgot about this fonction, thanks)