From a24e3f619ffac05e63cfb24b62685a6c0d4fdc9d Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 28 Sep 2020 11:48:27 +0200 Subject: [PATCH] dropdown list fixes with Bidi == RTL --- CHANGELOG.md | 1 + src/lv_widgets/lv_dropdown.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94e3ecae7..19a127c86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Fix selection of options with non-ASCII letters in dropdown list - Fix font loader to support LV_FONT_FMT_TXT_LARGE - Fix BIDI support in dropdown list +- Fix copying base dir in lv_obj_craete ## v7.5.0 (15.09.2020) diff --git a/src/lv_widgets/lv_dropdown.c b/src/lv_widgets/lv_dropdown.c index 2952b6325..eec0754d6 100644 --- a/src/lv_widgets/lv_dropdown.c +++ b/src/lv_widgets/lv_dropdown.c @@ -677,6 +677,10 @@ void lv_dropdown_open(lv_obj_t * ddlist) lv_obj_set_y(ext->page, lv_obj_get_y(ext->page) - (ext->page->coords.y2 - LV_VER_RES)); } } + + if(lv_label_get_align(label) == LV_LABEL_ALIGN_RIGHT) { + lv_obj_set_x(label, lv_obj_get_width_fit(ext->page) - lv_obj_get_width(label)); + } } /** @@ -739,7 +743,11 @@ static lv_design_res_t lv_dropdown_design(lv_obj_t * ddlist, const lv_area_t * c const char * txt; - txt = ext->dir != LV_DROPDOWN_DIR_LEFT ? opt_txt : ext->symbol; + bool rev = false; + if(ext->dir == LV_DROPDOWN_DIR_LEFT) rev = true; + if(lv_obj_get_base_dir(ddlist) == LV_BIDI_DIR_RTL) rev = true; + + txt = rev ? ext->symbol : opt_txt; if(txt) { _lv_txt_get_size(&txt_size, txt, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX, label_dsc.flag); @@ -759,7 +767,7 @@ static lv_design_res_t lv_dropdown_design(lv_obj_t * ddlist, const lv_area_t * c lv_draw_label(&txt_area, clip_area, &label_dsc, txt, NULL); } - txt = ext->dir != LV_DROPDOWN_DIR_LEFT ? ext->symbol : opt_txt; + txt =rev ? opt_txt : ext->symbol; if(txt) { _lv_txt_get_size(&txt_size, txt, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX, label_dsc.flag);