fix(obj): in obj event use the current target instead of target (#2785)

When the event is bubbling, use lv_event_get_current_target
to get the obj that needs to be processed

Signed-off-by: wangxuedong <wangxuedong@xiaomi.com>

Co-authored-by: wangxuedong <wangxuedong@xiaomi.com>
This commit is contained in:
xaowang96
2021-11-12 22:35:25 +08:00
committed by GitHub
parent b9a5078cd9
commit 25c2f53a67

View File

@@ -699,7 +699,7 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
LV_UNUSED(class_p);
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * obj = lv_event_get_target(e);
lv_obj_t * obj = lv_event_get_current_target(e);
if(code == LV_EVENT_PRESSED) {
lv_obj_add_state(obj, LV_STATE_PRESSED);
}