fix(dropdown) fix list width calculation
This commit is contained in:
@@ -760,7 +760,7 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
|||||||
if(lv_style_get_prop_inlined(obj_style->style, LV_STYLE_TRANSITION, &v) == false) continue;
|
if(lv_style_get_prop_inlined(obj_style->style, LV_STYLE_TRANSITION, &v) == false) continue;
|
||||||
const lv_style_transition_dsc_t * tr = v.ptr;
|
const lv_style_transition_dsc_t * tr = v.ptr;
|
||||||
|
|
||||||
/*Add the props t the set if not added yet or added but with smaller weight*/
|
/*Add the props to the set if not added yet or added but with smaller weight*/
|
||||||
uint32_t j;
|
uint32_t j;
|
||||||
for(j = 0; tr->props[j] != 0 && tsi < STYLE_TRANSITION_MAX; j++) {
|
for(j = 0; tr->props[j] != 0 && tsi < STYLE_TRANSITION_MAX; j++) {
|
||||||
uint32_t t;
|
uint32_t t;
|
||||||
|
|||||||
@@ -424,13 +424,13 @@ void lv_dropdown_open(lv_obj_t * dropdown_obj)
|
|||||||
lv_label_set_text_static(label, dropdown->options);
|
lv_label_set_text_static(label, dropdown->options);
|
||||||
lv_obj_set_width(dropdown->list, LV_SIZE_CONTENT);
|
lv_obj_set_width(dropdown->list, LV_SIZE_CONTENT);
|
||||||
|
|
||||||
|
lv_obj_update_layout(label);
|
||||||
/*Set smaller width to the width of the button*/
|
/*Set smaller width to the width of the button*/
|
||||||
if(lv_obj_get_width(dropdown->list) <= lv_obj_get_width(dropdown_obj) &&
|
if(lv_obj_get_width(dropdown->list) <= lv_obj_get_width(dropdown_obj) &&
|
||||||
(dropdown->dir == LV_DIR_TOP || dropdown->dir == LV_DIR_BOTTOM)) {
|
(dropdown->dir == LV_DIR_TOP || dropdown->dir == LV_DIR_BOTTOM)) {
|
||||||
lv_obj_set_width(dropdown->list, lv_obj_get_width(dropdown_obj));
|
lv_obj_set_width(dropdown->list, lv_obj_get_width(dropdown_obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_update_layout(label);
|
|
||||||
lv_coord_t label_h = lv_obj_get_height(label);
|
lv_coord_t label_h = lv_obj_get_height(label);
|
||||||
lv_coord_t top = lv_obj_get_style_pad_top(dropdown->list, LV_PART_MAIN);
|
lv_coord_t top = lv_obj_get_style_pad_top(dropdown->list, LV_PART_MAIN);
|
||||||
lv_coord_t bottom = lv_obj_get_style_pad_bottom(dropdown->list, LV_PART_MAIN);
|
lv_coord_t bottom = lv_obj_get_style_pad_bottom(dropdown->list, LV_PART_MAIN);
|
||||||
|
|||||||
Reference in New Issue
Block a user