mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
Merge 20363b09e6b00751a66fadb4ab0213ac414f1a00 into dev
This commit is contained in:
commit
a81a8b8d3e
@ -21,6 +21,7 @@
|
|||||||
- Support RTL in table (draw columns right to left)
|
- Support RTL in table (draw columns right to left)
|
||||||
- Support RTL in pretty layout (draw columns right to left)
|
- Support RTL in pretty layout (draw columns right to left)
|
||||||
- Skip objects in groups if they are in disabled state
|
- Skip objects in groups if they are in disabled state
|
||||||
|
- Fix dropdown selection with RTL basedirection
|
||||||
|
|
||||||
## v7.6.1 (06.10.2020)
|
## v7.6.1 (06.10.2020)
|
||||||
|
|
||||||
|
@ -1283,27 +1283,16 @@ static uint16_t get_id_on_point(lv_obj_t * ddlist, lv_coord_t x, lv_coord_t y)
|
|||||||
{
|
{
|
||||||
lv_obj_t * label = get_label(ddlist);
|
lv_obj_t * label = get_label(ddlist);
|
||||||
if(label == NULL) return 0;
|
if(label == NULL) return 0;
|
||||||
x -= label->coords.x1;
|
|
||||||
y -= label->coords.y1;
|
y -= label->coords.y1;
|
||||||
uint32_t letter_i;
|
|
||||||
|
|
||||||
const char * txt = lv_label_get_text(label);
|
const lv_font_t * font = lv_obj_get_style_text_font(label, LV_LABEL_PART_MAIN);
|
||||||
|
lv_coord_t font_h = lv_font_get_line_height(font);
|
||||||
|
lv_style_int_t line_space = lv_obj_get_style_text_line_space(label, LV_LABEL_PART_MAIN);
|
||||||
|
|
||||||
lv_point_t p = {x, y};
|
y += line_space / 2;
|
||||||
letter_i = lv_label_get_letter_on(label, &p);
|
lv_coord_t h = font_h + line_space;
|
||||||
uint32_t letter_i_byte_pos = _lv_txt_encoded_get_byte_id(txt, letter_i);
|
|
||||||
uint16_t opt = 0;
|
|
||||||
uint32_t i = 0;
|
|
||||||
uint32_t i_prev = 0;
|
|
||||||
|
|
||||||
uint32_t letter_cnt = 0;
|
uint16_t opt = y / h;
|
||||||
for(letter_cnt = 0; letter_cnt < letter_i; letter_cnt++) {
|
|
||||||
uint32_t letter = _lv_txt_encoded_next(txt, &i);
|
|
||||||
/*Count the lines to reach the clicked letter. But ignore the last '\n' because it
|
|
||||||
* still belongs to the clicked line*/
|
|
||||||
if(letter == '\n' && i_prev != letter_i_byte_pos) opt++;
|
|
||||||
i_prev = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return opt;
|
return opt;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user