Description
Hello, I’m trying LV_LABEL_LONG_SROLL_CIRC feature on a label with body drawing enabled and some padding values set.
Before enabling the text scroll I see the text at the expected position, but when the scrolling starts, the text is drawn beyond its initial and final positions (x1, x2), overlapping the padding area.
Is that a bug?
What MCU/Processor/Board and compiler are you using?
I’m using the simulator on a Microsoft VS Express 2017 for Windows Desktop project (CMAKE).
What do you experience?
See the screenshot below.
What do you expect?
I would expect the text never extends out of its bounds.
Code to reproduce
#include "lvgl/lvgl.h"
lv_style_t myStyle;
lv_obj_t* myLabel;
/* 1) Create the object with scrolling disabled */
void createLabel(void)
{
myLabel = lv_label_create(lv_scr_act(), NULL);
lv_label_set_long_mode(myLabel, LV_LABEL_LONG_DOT);
lv_obj_set_pos(myLabel, 30, 12);
lv_obj_set_size(myLabel, 260, 24);
lv_label_set_body_draw(myLabel, true);
lv_label_set_align(myLabel, LV_LABEL_ALIGN_LEFT);
lv_style_copy(&myStyle, &lv_style_plain);
myStyle.text.font = &lv_font_roboto_22;
myStyle.body.grad_color = myStyle.body.main_color = lv_color_hex(0xFF0ECBF5);
myStyle.body.opa = 0xff;
myStyle.text.color = lv_color_hex(0xFFFFFFFF);
myStyle.text.opa = 0xff;
myStyle.body.padding.left = myStyle.body.padding.right = 30;
myStyle.body.padding.top = myStyle.body.padding.bottom = 12;
lv_obj_set_style(myLabel, &myStyle);
lv_label_set_text(myLabel, "This is a very long text exceeding the bounds of the label");
}
/* 2) Enable text scrolling */
void enableScrolling(void)
{
lv_label_set_long_mode(myLabel, LV_LABEL_LONG_SROLL_CIRC);
}