1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(obj): swap lv_obj_move_forground/background

This commit is contained in:
Gabor Kiss-Vamosi 2021-03-01 12:12:18 +01:00
parent 16b9e3fd96
commit 1b79a5ae32
3 changed files with 10 additions and 9 deletions

View File

@ -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);
}
}

View File

@ -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

View File

@ -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);