Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(obj_tree): fix unintended click triggers on object deletion #5907

Merged
merged 1 commit into from
Mar 20, 2024

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>
@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
16 checks passed
@FASTSHIFT FASTSHIFT deleted the fix_obj_del_indev_reset branch March 25, 2024 02:34
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.

None yet

4 participants