From 188a9467b1bd45d42368a687736a9151d081c1e8 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 30 Sep 2021 18:06:42 +0200 Subject: [PATCH] fix(scrollbar) hide the scrollbar if the scrollble flag is removed --- src/core/lv_obj.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index f677cf0ef..79f9b97c4 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -254,6 +254,12 @@ void lv_obj_clear_flag(lv_obj_t * obj, lv_obj_flag_t f) bool was_on_layout = lv_obj_is_layout_positioned(obj); bool scrollable_chg = (f & LV_OBJ_FLAG_SCROLLABLE) != (obj->flags & LV_OBJ_FLAG_SCROLLABLE); + if(scrollable_chg) { + lv_area_t hor_area, ver_area; + lv_obj_get_scrollbar_area(obj, &hor_area, &ver_area); + lv_obj_invalidate_area(obj, &hor_area); + lv_obj_invalidate_area(obj, &ver_area); + } obj->flags &= (~f); @@ -267,13 +273,6 @@ void lv_obj_clear_flag(lv_obj_t * obj, lv_obj_flag_t f) if((was_on_layout != lv_obj_is_layout_positioned(obj)) || (f & (LV_OBJ_FLAG_LAYOUT_1 | LV_OBJ_FLAG_LAYOUT_2))) { lv_obj_mark_layout_as_dirty(lv_obj_get_parent(obj)); } - - if(scrollable_chg) { - lv_area_t hor_area, ver_area; - lv_obj_get_scrollbar_area(obj, &hor_area, &ver_area); - lv_obj_invalidate_area(obj, &hor_area); - lv_obj_invalidate_area(obj, &ver_area); - } } void lv_obj_add_state(lv_obj_t * obj, lv_state_t state)