From feb5b0f3459ef995ef6a7d181655f1ad40d38499 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 6 May 2021 20:10:50 +0200 Subject: [PATCH] fix(obj style) do not refresh the obj, if an empty style was removed --- src/core/lv_obj_style.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index 26cf31c6e..a511df0d2 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -107,6 +107,9 @@ void lv_obj_remove_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t { lv_state_t state = lv_obj_style_get_selector_state(selector); lv_part_t part = lv_obj_style_get_selector_part(selector); + lv_style_prop_t prop = LV_STYLE_PROP_ANY; + if(style && style->prop_cnt == 0) prop = LV_STYLE_PROP_INV; + uint32_t i = 0; bool deleted = false; while(i < obj->style_cnt) { @@ -143,8 +146,8 @@ void lv_obj_remove_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t /*The style from the current `i` index is removed, so `i` points to the next style. *Therefore it doesn't needs to be incremented*/ } - if(deleted) { - lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ANY); + if(deleted && prop != LV_STYLE_PROP_INV) { + lv_obj_refresh_style(obj, part, prop); } }