fix(screen change): allow postion change on screens to make screen change animations work

This commit is contained in:
Gabor Kiss-Vamosi
2021-03-11 22:30:51 +01:00
parent ae09ce5701
commit ca7d806eab

View File

@@ -458,12 +458,15 @@ void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, bool notify)
/*Check if the object inside the parent or not*/ /*Check if the object inside the parent or not*/
lv_area_t parent_fit_area; lv_area_t parent_fit_area;
bool on1 = false;
if(parent) {
lv_obj_get_coords_fit(parent, &parent_fit_area); lv_obj_get_coords_fit(parent, &parent_fit_area);
/* If the object is already out of the parent and its position is changes /* If the object is already out of the parent and its position is changes
* surely the scrollbars also changes so invalidate them*/ * surely the scrollbars also changes so invalidate them*/
bool on1 = _lv_area_is_in(&ori, &parent_fit_area, 0); on1 = _lv_area_is_in(&ori, &parent_fit_area, 0);
if(!on1) lv_obj_scrollbar_invalidate(parent); if(!on1) lv_obj_scrollbar_invalidate(parent);
}
obj->coords.x1 += diff.x; obj->coords.x1 += diff.x;
obj->coords.y1 += diff.y; obj->coords.y1 += diff.y;
@@ -483,8 +486,10 @@ void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, bool notify)
/* If the object was out of the parent invalidate the new scrollbar area too. /* If the object was out of the parent invalidate the new scrollbar area too.
* If it wasn't out of the parent but out now, also invalidate the srollbars*/ * If it wasn't out of the parent but out now, also invalidate the srollbars*/
if(parent) {
bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0); bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0);
if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent); if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent);
}
} }
void lv_obj_move_children_by(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff, bool ignore_floating) void lv_obj_move_children_by(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff, bool ignore_floating)