1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(label): limit self size by max_height style (#7542)

This commit is contained in:
Niklas Fiekas 2025-01-08 19:58:27 +01:00 committed by GitHub
parent 7b3320baf4
commit d47865afa1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -782,13 +782,15 @@ static void lv_label_event(const lv_obj_class_t * class_p, lv_event_t * e)
int32_t w;
if(lv_obj_get_style_width(obj, LV_PART_MAIN) == LV_SIZE_CONTENT && !obj->w_layout) w = LV_COORD_MAX;
else w = lv_obj_get_content_width(obj);
w = LV_MIN(w, lv_obj_get_style_max_width(obj, 0));
w = LV_MIN(w, lv_obj_get_style_max_width(obj, LV_PART_MAIN));
uint32_t dot_begin = label->dot_begin;
lv_label_revert_dots(obj);
lv_text_get_size(&label->size_cache, label->text, font, letter_space, line_space, w, flag);
lv_label_set_dots(obj, dot_begin);
label->size_cache.y = LV_MIN(label->size_cache.y, lv_obj_get_style_max_height(obj, LV_PART_MAIN));
label->invalid_size_cache = false;
}