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

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