mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fix page oveflow with right aligned object (due to RTL base dir)
This commit is contained in:
parent
6f001958ce
commit
fe35307d9f
@ -828,8 +828,10 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
|
||||
lv_obj_t * child;
|
||||
if(sign == LV_SIGNAL_CHILD_CHG) { /*Automatically move children to the scrollable object*/
|
||||
const lv_style_t * style = lv_page_get_style(page, LV_PAGE_STYLE_SCRL);
|
||||
const lv_style_t * style_bg = lv_page_get_style(page, LV_PAGE_STYLE_BG);
|
||||
const lv_style_t * style_scrl = lv_page_get_style(page, LV_PAGE_STYLE_SCRL);
|
||||
lv_fit_t fit_left = lv_page_get_scrl_fit_left(page);
|
||||
lv_fit_t fit_right = lv_page_get_scrl_fit_right(page);
|
||||
lv_fit_t fit_top = lv_page_get_scrl_fit_top(page);
|
||||
child = lv_obj_get_child(page, NULL);
|
||||
while(child != NULL) {
|
||||
@ -837,15 +839,19 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
lv_obj_t * tmp = child;
|
||||
child = lv_obj_get_child(page, child); /*Get the next child before move this*/
|
||||
|
||||
/* Reposition the child to take padding into account (Only if it's on (0;0) now)
|
||||
/* Reposition the child to take padding into account (Only if it's on (0;0) or (widht;height) coordinates now)
|
||||
* It's required to keep new the object on the same coordinate if FIT is enabled.*/
|
||||
if((tmp->coords.x1 == page->coords.x1) && (fit_left == LV_FIT_TIGHT || fit_left == LV_FIT_FILL)) {
|
||||
tmp->coords.x1 += style->body.padding.left;
|
||||
tmp->coords.x2 += style->body.padding.left;
|
||||
tmp->coords.x1 += style_scrl->body.padding.left;
|
||||
tmp->coords.x2 += style_scrl->body.padding.left;
|
||||
}
|
||||
else if((tmp->coords.x2 == page->coords.x2) && (fit_right == LV_FIT_TIGHT || fit_right == LV_FIT_FILL)) {
|
||||
tmp->coords.x1 -= style_scrl->body.padding.right * 2 + style_bg->body.padding.right;
|
||||
tmp->coords.x2 -= style_scrl->body.padding.right * 2 + style_bg->body.padding.right;
|
||||
}
|
||||
if((tmp->coords.y1 == page->coords.y1) && (fit_top == LV_FIT_TIGHT || fit_top == LV_FIT_FILL)) {
|
||||
tmp->coords.y1 += style->body.padding.top;
|
||||
tmp->coords.y2 += style->body.padding.top;
|
||||
tmp->coords.y1 += style_scrl->body.padding.top;
|
||||
tmp->coords.y2 += style_scrl->body.padding.top;
|
||||
}
|
||||
lv_obj_set_parent(tmp, ext->scrl);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user