diff --git a/examples/scroll/lv_example_scroll_3.c b/examples/scroll/lv_example_scroll_3.c index 67175b3b4..245c809e0 100644 --- a/examples/scroll/lv_example_scroll_3.c +++ b/examples/scroll/lv_example_scroll_3.c @@ -12,7 +12,7 @@ static void float_btn_event_cb(lv_obj_t * float_btn, lv_event_t e) lv_obj_t * list_btn = lv_list_add_btn(list, LV_SYMBOL_AUDIO, buf, NULL); btn_cnt++; lv_obj_scroll_to_view(list_btn, LV_ANIM_ON); - lv_obj_move_background(float_btn); + lv_obj_move_foreground(float_btn); } } diff --git a/lv_conf_template.h b/lv_conf_template.h index 9abb538be..eb9a687d9 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -145,6 +145,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * LV_LOG_LEVEL_INFO Log important events * LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem * LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail + * LV_LOG_LEVEL_USER Only logs added by the user * LV_LOG_LEVEL_NONE Do not log anything */ # define LV_LOG_LEVEL LV_LOG_LEVEL_WARN diff --git a/src/lv_core/lv_obj_tree.c b/src/lv_core/lv_obj_tree.c index ae425159e..5096e992c 100644 --- a/src/lv_core/lv_obj_tree.c +++ b/src/lv_core/lv_obj_tree.c @@ -194,11 +194,11 @@ void lv_obj_move_foreground(lv_obj_t * obj) lv_obj_invalidate(parent); - int32_t i; - for(i = lv_obj_get_child_id(obj) - 1; i > 0; i--) { - parent->spec_attr->children[i] = parent->spec_attr->children[i-1]; + uint32_t i; + for(i = lv_obj_get_child_id(obj); i < lv_obj_get_child_cnt(parent) - 1; i++) { + parent->spec_attr->children[i] = parent->spec_attr->children[i + 1]; } - parent->spec_attr->children[0] = obj; + parent->spec_attr->children[lv_obj_get_child_cnt(parent) - 1] = obj; /*Notify the new parent about the child*/ lv_signal_send(parent, LV_SIGNAL_CHILD_CHG, obj); @@ -214,11 +214,11 @@ void lv_obj_move_background(lv_obj_t * obj) lv_obj_invalidate(parent); - uint32_t i; - for(i = lv_obj_get_child_id(obj); i < lv_obj_get_child_cnt(parent) - 1; i++) { - parent->spec_attr->children[i] = parent->spec_attr->children[i + 1]; + int32_t i; + for(i = lv_obj_get_child_id(obj) - 1; i > 0; i--) { + parent->spec_attr->children[i] = parent->spec_attr->children[i-1]; } - parent->spec_attr->children[lv_obj_get_child_cnt(parent) - 1] = obj; + parent->spec_attr->children[0] = obj; /*Notify the new parent about the child*/ lv_signal_send(parent, LV_SIGNAL_CHILD_CHG, obj);