Apply ta label size fix from dev-6.0

This commit is contained in:
Themba Dube 2019-02-27 10:55:39 +01:00
parent 00ef778c7c
commit f509d8fa4f

View File

@ -1104,6 +1104,8 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
{
lv_res_t res;
lv_obj_t * ta = lv_obj_get_parent(scrl);
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
/* Include the ancient signal function */
res = scrl_signal(scrl, sign, param);
@ -1111,12 +1113,27 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
/*Set ext. size because the cursor might be out of this object*/
lv_obj_t * ta = lv_obj_get_parent(scrl);
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
lv_style_t * style_label = lv_obj_get_style(ext->label);
lv_coord_t font_h = lv_font_get_height(style_label->text.font);
scrl->ext_size = LV_MATH_MAX(scrl->ext_size, style_label->text.line_space + font_h);
}
#if 0
else if(sign == LV_SIGNAL_CORD_CHG) {
/*Set the label width according to the text area width*/
if(ext->label) {
if(lv_obj_get_width(ta) != lv_area_get_width(param) ||
lv_obj_get_height(ta) != lv_area_get_height(param)) {
lv_obj_t * scrl = lv_page_get_scrl(ta);
lv_style_t * style_scrl = lv_obj_get_style(scrl);
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor);
lv_obj_set_pos(ext->label, style_scrl->body.padding.hor, style_scrl->body.padding.ver);
lv_label_set_text(ext->label, NULL); /*Refresh the label*/
refr_cursor_area(ta);
}
}
}
#endif
return res;
}