mirror of
https://github.com/lvgl/lvgl.git
synced 2026-06-02 09:37:42 +08:00
don't invalidate hidden objects
This commit is contained in:
+9
-2
@@ -343,11 +343,14 @@ void lv_obj_clean(lv_obj_t *obj)
|
|||||||
*/
|
*/
|
||||||
void lv_obj_invalidate(lv_obj_t * obj)
|
void lv_obj_invalidate(lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
|
if(lv_obj_get_hidden(obj)) return;
|
||||||
|
|
||||||
/*Invalidate the object only if it belongs to the 'act_scr'*/
|
/*Invalidate the object only if it belongs to the 'act_scr'*/
|
||||||
lv_obj_t * obj_scr = lv_obj_get_screen(obj);
|
lv_obj_t * obj_scr = lv_obj_get_screen(obj);
|
||||||
if(obj_scr == lv_scr_act() ||
|
if(obj_scr == lv_scr_act() ||
|
||||||
obj_scr == lv_layer_top() ||
|
obj_scr == lv_layer_top() ||
|
||||||
obj_scr == lv_layer_sys()) {
|
obj_scr == lv_layer_sys())
|
||||||
|
{
|
||||||
/*Truncate recursively to the parents*/
|
/*Truncate recursively to the parents*/
|
||||||
lv_area_t area_trunc;
|
lv_area_t area_trunc;
|
||||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||||
@@ -364,6 +367,7 @@ void lv_obj_invalidate(lv_obj_t * obj)
|
|||||||
while(par != NULL) {
|
while(par != NULL) {
|
||||||
union_ok = lv_area_union(&area_trunc, &area_trunc, &par->coords);
|
union_ok = lv_area_union(&area_trunc, &area_trunc, &par->coords);
|
||||||
if(union_ok == false) break; /*If no common parts with parent break;*/
|
if(union_ok == false) break; /*If no common parts with parent break;*/
|
||||||
|
if(lv_obj_get_hidden(par)) return; /*If the parent is hidden then the child is hidden and won't be drawn*/
|
||||||
|
|
||||||
par = lv_obj_get_parent(par);
|
par = lv_obj_get_parent(par);
|
||||||
}
|
}
|
||||||
@@ -750,12 +754,15 @@ void lv_obj_report_style_mod(lv_style_t * style)
|
|||||||
*/
|
*/
|
||||||
void lv_obj_set_hidden(lv_obj_t * obj, bool en)
|
void lv_obj_set_hidden(lv_obj_t * obj, bool en)
|
||||||
{
|
{
|
||||||
|
if(!obj->hidden) lv_obj_invalidate(obj); /*Invalidate when not hidden (hidden objects are ignored) */
|
||||||
|
|
||||||
obj->hidden = en == false ? 0 : 1;
|
obj->hidden = en == false ? 0 : 1;
|
||||||
|
|
||||||
|
if(!obj->hidden) lv_obj_invalidate(obj); /*Invalidate when not hidden (hidden objects are ignored) */
|
||||||
|
|
||||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||||
par->signal_func(par, LV_SIGNAL_CHILD_CHG, obj);
|
par->signal_func(par, LV_SIGNAL_CHILD_CHG, obj);
|
||||||
|
|
||||||
lv_obj_invalidate(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user