fix(dropdown): fix selecting options after the last one

fix #1996
This commit is contained in:
Gabor Kiss-Vamosi
2021-01-06 12:06:51 +01:00
parent 8cd07b6ff5
commit 509a56fde9
2 changed files with 3 additions and 0 deletions

View File

@@ -1298,6 +1298,7 @@ static void page_press_handler(lv_obj_t * page)
static uint16_t get_id_on_point(lv_obj_t * ddlist, lv_coord_t y)
{
lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist);
lv_obj_t * label = get_label(ddlist);
if(label == NULL) return 0;
y -= label->coords.y1;
@@ -1311,6 +1312,7 @@ static uint16_t get_id_on_point(lv_obj_t * ddlist, lv_coord_t y)
uint16_t opt = y / h;
if(opt >= ext->option_cnt) opt = ext->option_cnt - 1;
return opt;
}