Skip to content

Conversation

@FASTSHIFT
Copy link
Collaborator

Description of the feature or fix

When obj is deleted, indev will be reset. At this time, if the finger happens to be released when sliding to another obj, the click event will be triggered by the obj by mistake.

static void gesture_event_cb(lv_event_t* e)
{
    lv_obj_t* obj = lv_event_get_current_target(e);
    lv_obj_del(obj);
}

static void click_event_cb(lv_event_t* e)
{
    LV_LOG_USER("Clicked");
}

static void swipe_test(void)
{
    lv_obj_t* obj = lv_obj_create(lv_scr_act());
    lv_obj_set_size(obj, 200, 200);
    lv_obj_center(obj);
    lv_obj_clear_flag(obj, LV_OBJ_FLAG_GESTURE_BUBBLE);
    lv_obj_add_event_cb(obj, gesture_event_cb, LV_EVENT_GESTURE, NULL);

    lv_obj_t* btn = lv_btn_create(lv_scr_act());
    lv_obj_set_size(btn, 100, 100);
    lv_obj_align_to(btn, obj, LV_ALIGN_OUT_BOTTOM_MID, 0, -30);
    lv_obj_add_event_cb(btn, click_event_cb, LV_EVENT_CLICKED, NULL);
}
obj_del_indev_reset.mp4

Notes

…tly trigger clicks on other objects

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
@FASTSHIFT FASTSHIFT force-pushed the fix_obj_del_indev_reset branch from 70b7386 to 83688b8 Compare March 19, 2024 06:42
@XuNeo XuNeo changed the title fix(obj_tree): fixed issue where deleting one object would inadvertently trigger clicks on other objects fix(obj_tree): fix unintended click triggers on object deletion Mar 19, 2024
@FASTSHIFT FASTSHIFT merged commit ee26f1d into lvgl:master Mar 20, 2024
@FASTSHIFT FASTSHIFT deleted the fix_obj_del_indev_reset branch March 25, 2024 02:34
HongChao6 pushed a commit to HongChao6/lvgl that referenced this pull request Oct 18, 2024
…#5907)

Change-Id: I3c7244f3ffecad0ba02825f763c413010d96dfb4
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants