mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
fix(flex) fix flex row layout calculation with RTL base direction
This commit is contained in:
parent
42145ec2a9
commit
c77ec58af7
@ -353,7 +353,7 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i
|
||||
|
||||
lv_coord_t place_gap = 0;
|
||||
place_content(f->main_place, max_main_size, t->track_main_size, t->item_cnt, &main_pos, &place_gap);
|
||||
// if(f->row && rtl) main_pos += t->track_main_size;
|
||||
if(f->row && rtl) main_pos += lv_obj_get_content_width(cont);
|
||||
|
||||
lv_obj_t * item = lv_obj_get_child(cont, item_first_id);
|
||||
/*Reposition the children*/
|
||||
|
@ -132,7 +132,7 @@ void lv_tabview_set_act(lv_obj_t * obj, uint32_t id, lv_anim_enable_t anim_en)
|
||||
if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) != LV_BASE_DIR_RTL) {
|
||||
lv_obj_scroll_to_x(cont, id * (gap + w), anim_en);
|
||||
} else {
|
||||
int32_t id_rtl = (int32_t) -id - 1;
|
||||
int32_t id_rtl = (int32_t) -id;
|
||||
lv_obj_scroll_to_x(cont, (gap + w) * id_rtl, anim_en);
|
||||
}
|
||||
|
||||
@ -283,9 +283,11 @@ static void cont_scroll_end_event_cb(lv_event_t * e)
|
||||
lv_obj_get_scroll_end(cont, &p);
|
||||
|
||||
lv_coord_t w = lv_obj_get_content_width(cont);
|
||||
lv_coord_t t = (p.x + w/ 2) / w;
|
||||
lv_coord_t t;
|
||||
|
||||
if(lv_obj_get_style_base_dir(tv, LV_PART_MAIN) == LV_BASE_DIR_RTL) t = -(p.x - w/ 2) / w;
|
||||
else t = (p.x + w/ 2) / w;
|
||||
|
||||
if(lv_obj_get_style_base_dir(tv, LV_PART_MAIN) == LV_BASE_DIR_RTL) t = -t;
|
||||
if(t < 0) t = 0;
|
||||
lv_tabview_set_act(tv, t, LV_ANIM_ON);
|
||||
lv_event_send(tv, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user