From e66b9350617eee15e94fb6a353283433e4c2c494 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 23 Jun 2021 21:53:16 +0200 Subject: [PATCH] fix(dropdown) forget the selected option on encoder longpress --- src/widgets/lv_dropdown.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/widgets/lv_dropdown.c b/src/widgets/lv_dropdown.c index b5b9aa234..58ca6b74d 100644 --- a/src/widgets/lv_dropdown.c +++ b/src/widgets/lv_dropdown.c @@ -615,10 +615,14 @@ static void lv_dropdown_event(const lv_obj_class_t * class_p, lv_event_t * e) /*Encoders need special handling*/ if(indev_type == LV_INDEV_TYPE_ENCODER) { /*Open the list if editing*/ - if(editing) lv_dropdown_open(obj); + if(editing) { + lv_dropdown_open(obj); + } /*Close the list if navigating*/ - else + else { + dropdown->sel_opt_id = dropdown->sel_opt_id_orig; lv_dropdown_close(obj); + } } } else if(code == LV_EVENT_DEFOCUSED || code == LV_EVENT_LEAVE) {