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:
@@ -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_UNUSED(class_p);
|
||||||
|
|
||||||
lv_event_code_t code = lv_event_get_code(e);
|
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) {
|
if(code == LV_EVENT_PRESSED) {
|
||||||
lv_obj_add_state(obj, LV_STATE_PRESSED);
|
lv_obj_add_state(obj, LV_STATE_PRESSED);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user