From 33ba7225f55f0cb17f73ce891466c7ebe1327898 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 16 Jul 2021 20:35:10 +0200 Subject: [PATCH] fix(obj) fix size invalidation issue on padding change If a style properties with LV_STYLE_PROP_LAYOUT_REFR is applied on a not MAIN part it might effect the size if the size is LV_SIZE_CONTENT. So check it in lv_obj_refresh_style() --- src/core/lv_obj_style.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index d8cc70277..21a853868 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -175,9 +175,15 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style lv_part_t part = lv_obj_style_get_selector_part(selector); - if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ANY || (prop & LV_STYLE_PROP_LAYOUT_REFR))) { - lv_event_send(obj, LV_EVENT_STYLE_CHANGED, NULL); - lv_obj_mark_layout_as_dirty(obj); + if(prop & LV_STYLE_PROP_LAYOUT_REFR) { + if(part == LV_PART_ANY || + part == LV_PART_MAIN || + lv_obj_get_style_height(obj, 0) == LV_SIZE_CONTENT || + lv_obj_get_style_width(obj, 0) == LV_SIZE_CONTENT) + { + lv_event_send(obj, LV_EVENT_STYLE_CHANGED, NULL); + lv_obj_mark_layout_as_dirty(obj); + } } if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ANY || (prop & LV_STYLE_PROP_PARENT_LAYOUT_REFR))) { lv_obj_t * parent = lv_obj_get_parent(obj);