From e6c4845983250282a94e29c1fddfa0e609d4d67b Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 18 Dec 2018 07:25:34 +0100 Subject: [PATCH] lv_label: remove space from LV_LABEL_LONG_ROLL/SCROLL anims --- lv_objx/lv_label.c | 8 ++++---- lv_objx/lv_list.c | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lv_objx/lv_label.c b/lv_objx/lv_label.c index 37af54bf2..0fddfea36 100644 --- a/lv_objx/lv_label.c +++ b/lv_objx/lv_label.c @@ -787,7 +787,7 @@ static void lv_label_refr_text(lv_obj_t * label) anim.var = label; anim.repeat = 1; anim.playback = 1; - anim.start = lv_font_get_width(font, ' '); + anim.start = 0; anim.act_time = 0; anim.end_cb = NULL; anim.path = lv_anim_path_linear; @@ -797,7 +797,7 @@ static void lv_label_refr_text(lv_obj_t * label) anim.repeat_pause = anim.playback_pause; if(lv_obj_get_width(label) > lv_obj_get_width(parent)) { - anim.end = lv_obj_get_width(parent) - lv_obj_get_width(label) - lv_font_get_width(font, ' '); + anim.end = lv_obj_get_width(parent) - lv_obj_get_width(label); anim.fp = (lv_anim_fp_t) lv_obj_set_x; anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end); lv_anim_create(&anim); @@ -817,7 +817,7 @@ static void lv_label_refr_text(lv_obj_t * label) anim.var = label; anim.repeat = 1; anim.playback = 1; - anim.start = lv_font_get_width(font, ' '); + anim.start = 0; anim.act_time = 0; anim.end_cb = NULL; anim.path = lv_anim_path_linear; @@ -826,7 +826,7 @@ static void lv_label_refr_text(lv_obj_t * label) bool hor_anim = false; if(size.x > lv_obj_get_width(label)) { - anim.end = lv_obj_get_width(label) - size.x - lv_font_get_width(font, ' '); + anim.end = lv_obj_get_width(label) - size.x; anim.fp = (lv_anim_fp_t) lv_label_set_offset_x; anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end); lv_anim_create(&anim); diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index 7f367af17..1612c8c59 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -220,11 +220,12 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const void * img_src, const char * txt, } #endif if(txt != NULL) { + lv_coord_t btn_hor_pad = ext->styles_btn[LV_BTN_STYLE_REL]->body.padding.hor; lv_obj_t * label = lv_label_create(liste, NULL); lv_label_set_text(label, txt); lv_obj_set_click(label, false); lv_label_set_long_mode(label, LV_LABEL_LONG_ROLL); - lv_obj_set_width(label, liste->coords.x2 - label->coords.x1); + lv_obj_set_width(label, liste->coords.x2 - label->coords.x1 - btn_hor_pad); if(label_signal == NULL) label_signal = lv_obj_get_signal_func(label); }