diff --git a/lv_conf_template.h b/lv_conf_template.h index d6e450290..a591eb9fd 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -275,7 +275,14 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the d typedef void * lv_obj_user_data_t; /*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ -#define LV_OBJ_REALIGN 1 +#define LV_USE_OBJ_REALIGN 1 + +/* Enable to make the object clickable on a larger area. + * LV_EXT_CLICK_AREA_OFF or 0: Disable this feature + * LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px) + * LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px) + */ +#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF /*================== * LV OBJ X USAGE @@ -346,6 +353,7 @@ typedef void * lv_obj_user_data_t; #if LV_USE_LABEL != 0 /*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/ # define LV_LABEL_DEF_SCROLL_SPEED 25 +# define LV_LABEL_WAIT_CHAR_COUNT 3 /* Waiting period at beginning/end of animation cycle */ #endif /*LED (dependencies: -)*/ diff --git a/src/lv_conf_checker.h b/src/lv_conf_checker.h index fd2e5f6f2..028aca2a7 100644 --- a/src/lv_conf_checker.h +++ b/src/lv_conf_checker.h @@ -420,8 +420,17 @@ /*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/ /*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ -#ifndef LV_OBJ_REALIGN -#define LV_OBJ_REALIGN 1 +#ifndef LV_USE_OBJ_REALIGN +#define LV_USE_OBJ_REALIGN 1 +#endif + +/* Enable to make the object clickable on a larger area. + * LV_EXT_CLICK_AREA_OFF or 0: Disable this feature + * LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px) + * LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px) + */ +#ifndef LV_USE_EXT_CLICK_AREA +#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF #endif /*================== @@ -533,6 +542,9 @@ #ifndef LV_LABEL_DEF_SCROLL_SPEED # define LV_LABEL_DEF_SCROLL_SPEED 25 #endif +#ifndef LV_LABEL_WAIT_CHAR_COUNT +# define LV_LABEL_WAIT_CHAR_COUNT 3 /* Waiting period at beginning/end of animation cycle */ +#endif #endif /*LED (dependencies: -)*/ diff --git a/src/lv_core/lv_group.c b/src/lv_core/lv_group.c index 7ea018548..15009fea0 100644 --- a/src/lv_core/lv_group.c +++ b/src/lv_core/lv_group.c @@ -110,6 +110,7 @@ void lv_group_del(lv_group_t * group) } lv_ll_clear(&(group->obj_ll)); + lv_ll_rem(&LV_GC_ROOT(_lv_group_ll), group); lv_mem_free(group); } diff --git a/src/lv_core/lv_indev.c b/src/lv_core/lv_indev.c index 632540640..7fcc899b0 100644 --- a/src/lv_core/lv_indev.c +++ b/src/lv_core/lv_indev.c @@ -989,9 +989,26 @@ static lv_obj_t * indev_search_obj(const lv_indev_proc_t * proc, lv_obj_t * obj) { lv_obj_t * found_p = NULL; - /*If the point is on this object*/ - /*Check its children too*/ + /*If the point is on this object check its children too*/ +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY + lv_area_t ext_area; + ext_area.x1 = obj->coords.x1 - obj->ext_click_pad_hor; + ext_area.x2 = obj->coords.x2 + obj->ext_click_pad_hor; + ext_area.y1 = obj->coords.y1 - obj->ext_click_pad_ver; + ext_area.y2 = obj->coords.y2 + obj->ext_click_pad_ver; + + if(lv_area_is_point_on(&ext_area, &proc->types.pointer.act_point)) { +#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL + lv_area_t ext_area; + ext_area.x1 = obj->coords.x1 - obj->ext_click_pad.x1; + ext_area.x2 = obj->coords.x2 + obj->ext_click_pad.x2; + ext_area.y1 = obj->coords.y1 - obj->ext_click_pad.y1; + ext_area.y2 = obj->coords.y2 + obj->ext_click_pad.y2; + + if(lv_area_is_point_on(&ext_area, &proc->types.pointer.act_point)) { +#else if(lv_area_is_point_on(&obj->coords, &proc->types.pointer.act_point)) { +#endif lv_obj_t * i; LV_LL_READ(obj->child_ll, i) diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index 09ddb1ce5..fe42aad7e 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -143,10 +143,19 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) new_obj->coords.y1 = 0; new_obj->coords.x2 = lv_disp_get_hor_res(NULL) - 1; new_obj->coords.y2 = lv_disp_get_ver_res(NULL) - 1; - new_obj->ext_size = 0; + new_obj->ext_draw_pad = 0; + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL + memset(&new_obj->ext_click_pad, 0, sizeof(new_obj->ext_click_pad)); +#endif + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY + new_obj->ext_click_pad_hor = 0; + new_obj->ext_click_pad_ver = 0; +#endif /*Init realign*/ -#if LV_OBJ_REALIGN +#if LV_USE_OBJ_REALIGN new_obj->realign.align = LV_ALIGN_CENTER; new_obj->realign.xofs = 0; new_obj->realign.yofs = 0; @@ -211,10 +220,19 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) new_obj->coords.y1 = parent->coords.y1; new_obj->coords.x2 = parent->coords.x1 + LV_OBJ_DEF_WIDTH; new_obj->coords.y2 = parent->coords.y1 + LV_OBJ_DEF_HEIGHT; - new_obj->ext_size = 0; + new_obj->ext_draw_pad = 0; + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL + memset(&new_obj->ext_click_pad, 0, sizeof(new_obj->ext_click_pad)); +#endif + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY + new_obj->ext_click_pad_hor = 0; + new_obj->ext_click_pad_ver = 0; +#endif /*Init realign*/ -#if LV_OBJ_REALIGN +#if LV_USE_OBJ_REALIGN new_obj->realign.align = LV_ALIGN_CENTER; new_obj->realign.xofs = 0; new_obj->realign.yofs = 0; @@ -234,6 +252,16 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) lv_obj_set_design_cb(new_obj, lv_obj_design); new_obj->event_cb = NULL; + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL + memset(&new_obj->ext_click_pad, 0, sizeof(new_obj->ext_click_pad)); +#endif + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY + new_obj->ext_click_pad_hor = 0; + new_obj->ext_click_pad_ver = 0; +#endif + /*Init. user date*/ #if LV_USE_USER_DATA_SINGLE memset(&new_obj->user_data, 0, sizeof(lv_obj_user_data_t)); @@ -267,7 +295,16 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) /*Copy the attributes if required*/ if(copy != NULL) { lv_area_copy(&new_obj->coords, ©->coords); - new_obj->ext_size = copy->ext_size; + new_obj->ext_draw_pad = copy->ext_draw_pad; + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL + lv_area_copy(&new_obj->ext_click_pad, ©->ext_click_pad); +#endif + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY + new_obj->ext_click_pad_hor = copy->ext_click_pad_hor; + new_obj->ext_click_pad_ver = copy->ext_click_pad_ver; +#endif /*Set free data*/ #if LV_USE_USER_DATA_SINGLE @@ -280,7 +317,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) #endif /*Copy realign*/ -#if LV_OBJ_REALIGN +#if LV_USE_OBJ_REALIGN new_obj->realign.align = copy->realign.align; new_obj->realign.xofs = copy->realign.xofs; new_obj->realign.yofs = copy->realign.yofs; @@ -449,7 +486,7 @@ void lv_obj_invalidate(const lv_obj_t * obj) lv_obj_t * par = lv_obj_get_parent(obj); bool union_ok = true; /*Start with the original coordinates*/ - lv_coord_t ext_size = obj->ext_size; + lv_coord_t ext_size = obj->ext_draw_pad; lv_area_copy(&area_trunc, &obj->coords); area_trunc.x1 -= ext_size; area_trunc.y1 -= ext_size; @@ -530,6 +567,7 @@ void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) { /*Convert x and y to absolute coordinates*/ lv_obj_t * par = obj->par; + x = x + par->coords.x1; y = y + par->coords.y1; @@ -610,7 +648,7 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h) lv_area_t ori; lv_obj_get_coords(obj, &ori); - // Set the length and height + /*Set the length and height*/ obj->coords.x2 = obj->coords.x1 + w - 1; obj->coords.y2 = obj->coords.y1 + h - 1; @@ -632,7 +670,7 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h) lv_obj_invalidate(obj); /*Automatically realign the object if required*/ -#if LV_OBJ_REALIGN +#if LV_USE_OBJ_REALIGN if(obj->realign.auto_realign) lv_obj_realign(obj); #endif } @@ -793,7 +831,7 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co lv_obj_set_pos(obj, new_x, new_y); -#if LV_OBJ_REALIGN +#if LV_USE_OBJ_REALIGN /*Save the last align parameters to use them in `lv_obj_realign`*/ obj->realign.align = align; obj->realign.xofs = x_mod; @@ -942,7 +980,7 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_obj_set_pos(obj, new_x, new_y); -#if LV_OBJ_REALIGN +#if LV_USE_OBJ_REALIGN /*Save the last align parameters to use them in `lv_obj_realign`*/ obj->realign.align = align; obj->realign.xofs = x_mod; @@ -958,7 +996,7 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, */ void lv_obj_realign(lv_obj_t * obj) { -#if LV_OBJ_REALIGN +#if LV_USE_OBJ_REALIGN if(obj->realign.origo_align) lv_obj_align_origo(obj, obj->realign.base, obj->realign.align, obj->realign.xofs, obj->realign.yofs); @@ -967,7 +1005,7 @@ void lv_obj_realign(lv_obj_t * obj) obj->realign.yofs); #else (void)obj; - LV_LOG_WARN("lv_obj_realaign: no effect because LV_OBJ_REALIGN = 0"); + LV_LOG_WARN("lv_obj_realaign: no effect because LV_USE_OBJ_REALIGN = 0"); #endif } @@ -979,15 +1017,47 @@ void lv_obj_realign(lv_obj_t * obj) */ void lv_obj_set_auto_realign(lv_obj_t * obj, bool en) { -#if LV_OBJ_REALIGN +#if LV_USE_OBJ_REALIGN obj->realign.auto_realign = en ? 1 : 0; #else (void)obj; (void)en; - LV_LOG_WARN("lv_obj_set_auto_realign: no effect because LV_OBJ_REALIGN = 0"); + LV_LOG_WARN("lv_obj_set_auto_realign: no effect because LV_USE_OBJ_REALIGN = 0"); #endif } +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY +/** + * Set the size of an extended clickable area + * @param obj pointer to an object + * @param w extended width to both sides + * @param h extended height to both sides + */ +void lv_obj_set_ext_click_area(lv_obj_t * obj, uint8_t w, uint8_t h) +{ + obj->ext_click_pad_hor= w; + obj->ext_click_pad_ver = h; +} +#endif + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL +/** + * Set the size of an extended clickable area + * @param obj pointer to an object + * @param left extended clickable are on the left [px] + * @param right extended clickable are on the right [px] + * @param top extended clickable are on the top [px] + * @param bottom extended clickable are on the bottom [px] + */ +void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right, lv_coord_t top, lv_coord_t bottom) +{ + obj->ext_click_pad.x1 = left; + obj->ext_click_pad.x2 = right; + obj->ext_click_pad.y1 = top; + obj->ext_click_pad.y2 = bottom; +} +#endif + /*--------------------- * Appearance set *--------------------*/ @@ -1295,10 +1365,10 @@ void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size) * Send a 'LV_SIGNAL_REFR_EXT_SIZE' signal to the object * @param obj pointer to an object */ -void lv_obj_refresh_ext_size(lv_obj_t * obj) +void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj) { - obj->ext_size = 0; - obj->signal_cb(obj, LV_SIGNAL_REFR_EXT_SIZE, NULL); + obj->ext_draw_pad = 0; + obj->signal_cb(obj, LV_SIGNAL_REFR_EXT_DRAW_PAD, NULL); lv_obj_invalidate(obj); } @@ -1588,15 +1658,6 @@ lv_coord_t lv_obj_get_height_fit(lv_obj_t * obj) return lv_obj_get_height(obj) - style->body.padding.top - style->body.padding.bottom; } -/** - * Get the extended size attribute of an object - * @param obj pointer to an object - * @return the extended size attribute - */ -lv_coord_t lv_obj_get_ext_size(const lv_obj_t * obj) -{ - return obj->ext_size; -} /** * Get the automatic realign property of the object. @@ -1605,7 +1666,7 @@ lv_coord_t lv_obj_get_ext_size(const lv_obj_t * obj) */ bool lv_obj_get_auto_realign(lv_obj_t * obj) { -#if LV_OBJ_REALIGN +#if LV_USE_OBJ_REALIGN return obj->realign.auto_realign ? true : false; #else (void)obj; @@ -1613,6 +1674,50 @@ bool lv_obj_get_auto_realign(lv_obj_t * obj) #endif } +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY +/** + * Get the horizontal padding of extended clickable area + * @param obj pointer to an object + * @return the horizontal padding + */ +uint8_t lv_obj_get_ext_click_pad_hor(const lv_obj_t * obj) +{ + return obj->ext_click_pad_hor; +} + +/** + * Get the vertical padding of extended clickable area + * @param obj pointer to an object + * @return the vertical padding + */ +uint8_t lv_obj_get_ext_click_pad_ver(const lv_obj_t * obj) +{ + return obj->ext_click_pad_ver; +} +#endif + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL +/** + * Get the horizontal padding of extended clickable area + * @param obj pointer to an object + * @return the horizontal padding + */ +const lv_area_t * lv_obj_get_ext_click_pad(const lv_obj_t * obj) +{ + return &obj->ext_click_pad; +} +#endif + +/** + * Get the extended size attribute of an object + * @param obj pointer to an object + * @return the extended size attribute + */ +lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj) +{ + return obj->ext_draw_pad; +} + /*----------------- * Appearance get *---------------*/ @@ -1979,10 +2084,10 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param) if(sign == LV_SIGNAL_CHILD_CHG) { /*Return 'invalid' if the child change signal is not enabled*/ if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) res = LV_RES_INV; - } else if(sign == LV_SIGNAL_REFR_EXT_SIZE) { - if(style->body.shadow.width > obj->ext_size) obj->ext_size = style->body.shadow.width; + } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { + if(style->body.shadow.width > obj->ext_draw_pad) obj->ext_draw_pad = style->body.shadow.width; } else if(sign == LV_SIGNAL_STYLE_CHG) { - lv_obj_refresh_ext_size(obj); + lv_obj_refresh_ext_draw_pad(obj); } else if(sign == LV_SIGNAL_GET_TYPE) { lv_obj_type_t * buf = param; buf->type[0] = "lv_obj"; diff --git a/src/lv_core/lv_obj.h b/src/lv_core/lv_obj.h index 1fa0bf1df..764baf1e2 100644 --- a/src/lv_core/lv_obj.h +++ b/src/lv_core/lv_obj.h @@ -42,11 +42,15 @@ extern "C" { #error "LittlevGL: LV_ANTIALIAS can be only 0 or 1" #endif +#define LV_MAX_ANCESTOR_NUM 8 + #define LV_ANIM_IN 0x00 /*Animation to show an object. 'OR' it with lv_anim_builtin_t*/ #define LV_ANIM_OUT 0x80 /*Animation to hide an object. 'OR' it with lv_anim_builtin_t*/ #define LV_ANIM_DIR_MASK 0x80 /*ANIM_IN/ANIM_OUT mask*/ -#define LV_MAX_ANCESTOR_NUM 8 +#define LV_EXT_CLICK_AREA_OFF 0 +#define LV_EXT_CLICK_AREA_TINY 1 +#define LV_EXT_CLICK_AREA_FULL 2 /********************** * TYPEDEFS @@ -106,7 +110,7 @@ enum { LV_SIGNAL_CORD_CHG, LV_SIGNAL_PARENT_SIZE_CHG, LV_SIGNAL_STYLE_CHG, - LV_SIGNAL_REFR_EXT_SIZE, + LV_SIGNAL_REFR_EXT_DRAW_PAD, LV_SIGNAL_GET_TYPE, _LV_SIGNAL_FEEDBACK_SECTION_START, @@ -156,7 +160,7 @@ enum { }; typedef uint8_t lv_align_t; -#if LV_OBJ_REALIGN +#if LV_USE_OBJ_REALIGN typedef struct { const struct _lv_obj_t * base; @@ -194,6 +198,16 @@ typedef struct _lv_obj_t #if LV_USE_GROUP != 0 void * group_p; /*Pointer to the group of the object*/ #endif + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY + uint8_t ext_click_pad_hor; + uint8_t ext_click_pad_ver; +#endif + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL + lv_area_t ext_click_pad; +#endif + /*Attributes and states*/ uint8_t click : 1; /*1: Can be pressed by an input device*/ uint8_t drag : 1; /*1: Enable the dragging*/ @@ -208,9 +222,8 @@ typedef struct _lv_obj_t `lv_protect_t`*/ lv_opa_t opa_scale; /*Scale down the opacity by this factor. Effects all children as well*/ - lv_coord_t - ext_size; /*EXTtend the size of the object in every direction. E.g. for shadow drawing*/ -#if LV_OBJ_REALIGN + lv_coord_t ext_draw_pad; /*EXTtend the size in every direction for drawing. */ +#if LV_USE_OBJ_REALIGN lv_reailgn_t realign; #endif @@ -398,6 +411,28 @@ void lv_obj_realign(lv_obj_t * obj); */ void lv_obj_set_auto_realign(lv_obj_t * obj, bool en); +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY +/** + * Set the size of an extended clickable area + * @param obj pointer to an object + * @param w extended width to both sides + * @param h extended height to both sides + */ +void lv_obj_set_ext_click_area(lv_obj_t * obj, uint8_t w, uint8_t h); +#endif + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL +/** + * Set the size of an extended clickable area + * @param obj pointer to an object + * @param left extended clickable are on the left [px] + * @param right extended clickable are on the right [px] + * @param top extended clickable are on the top [px] + * @param bottom extended clickable are on the bottom [px] + */ +void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right, lv_coord_t top, lv_coord_t bottom); +#endif + /*--------------------- * Appearance set *--------------------*/ @@ -573,7 +608,7 @@ void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size); * Send a 'LV_SIGNAL_REFR_EXT_SIZE' signal to the object * @param obj pointer to an object */ -void lv_obj_refresh_ext_size(lv_obj_t * obj); +void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj); #if LV_USE_ANIMATION /** @@ -695,13 +730,6 @@ lv_coord_t lv_obj_get_width_fit(lv_obj_t * obj); */ lv_coord_t lv_obj_get_height_fit(lv_obj_t * obj); -/** - * Get the extended size attribute of an object - * @param obj pointer to an object - * @return the extended size attribute - */ -lv_coord_t lv_obj_get_ext_size(const lv_obj_t * obj); - /** * Get the automatic realign property of the object. * @param obj pointer to an object @@ -709,6 +737,40 @@ lv_coord_t lv_obj_get_ext_size(const lv_obj_t * obj); */ bool lv_obj_get_auto_realign(lv_obj_t * obj); + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY +/** + * Get the horizontal padding of extended clickable area + * @param obj pointer to an object + * @return the horizontal padding + */ +uint8_t lv_obj_get_ext_click_pad_hor(const lv_obj_t * obj); + +/** + * Get the vertical padding of extended clickable area + * @param obj pointer to an object + * @return the vertical padding + */ +uint8_t lv_obj_get_ext_click_pad_ver(const lv_obj_t * obj); + +#endif + +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL +/** + * Get the horizontal padding of extended clickable area + * @param obj pointer to an object + * @return the horizontal padding + */ +const lv_area_t * lv_obj_get_ext_click_pad(const lv_obj_t * obj); +#endif + +/** + * Get the extended size attribute of an object + * @param obj pointer to an object + * @return the extended size attribute + */ +lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj); + /*----------------- * Appearance get *---------------*/ diff --git a/src/lv_core/lv_refr.c b/src/lv_core/lv_refr.c index 3d80c04e5..b8ff84710 100644 --- a/src/lv_core/lv_refr.c +++ b/src/lv_core/lv_refr.c @@ -488,7 +488,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p) lv_area_t obj_mask; lv_area_t obj_ext_mask; lv_area_t obj_area; - lv_coord_t ext_size = obj->ext_size; + lv_coord_t ext_size = obj->ext_draw_pad; lv_obj_get_coords(obj, &obj_area); obj_area.x1 -= ext_size; obj_area.y1 -= ext_size; @@ -513,7 +513,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p) LV_LL_READ_BACK(obj->child_ll, child_p) { lv_obj_get_coords(child_p, &child_area); - ext_size = child_p->ext_size; + ext_size = child_p->ext_draw_pad; child_area.x1 -= ext_size; child_area.y1 -= ext_size; child_area.x2 += ext_size; diff --git a/src/lv_misc/lv_area.c b/src/lv_misc/lv_area.c index 45ea1b78c..7b9918c3e 100644 --- a/src/lv_misc/lv_area.c +++ b/src/lv_misc/lv_area.c @@ -6,6 +6,7 @@ /********************* * INCLUDES *********************/ +#include "lv_conf.h" #include "lv_area.h" #include "lv_math.h" @@ -153,6 +154,29 @@ bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p) return is_on; } +#if LV_USE_EXTENDED_CLICK_AREA_TINY +/** + * Check if a point is on an area + * @param a_p pointer to an area + * @param p_p pointer to a point + * @param ext_hor extended horizontal padding + * @param ext_ver extended horizontal padding + * @return false:the point is out of the area + */ +bool lv_area_ext_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, uint8_t ext_hor, uint8_t ext_ver) +{ + bool is_on = false; + + if(( (p_p->x + ext_hor) >= a_p->x1 && p_p->x <= (a_p->x2 + ext_hor) ) && + ( (p_p->y + ext_ver) >= a_p->y1 && p_p->y <= (a_p->y2 + ext_ver)) ) { + is_on = true; + } + + return is_on; +} + +#endif + /** * Check if two area has common parts * @param a1_p pointer to an area. diff --git a/src/lv_misc/lv_area.h b/src/lv_misc/lv_area.h index 10e0d6a63..c07e2767d 100644 --- a/src/lv_misc/lv_area.h +++ b/src/lv_misc/lv_area.h @@ -140,6 +140,18 @@ void lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * */ bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p); +#if LV_USE_EXTENDED_CLICK_AREA_TINY +/** + * Check if a point is on an area + * @param a_p pointer to an area + * @param p_p pointer to a point + * @param ext_hor extended horizontal padding + * @param ext_ver extended horizontal padding + * @return false:the point is out of the area + */ +bool lv_area_ext_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, uint8_t ext_hor, uint8_t ext_ver); +#endif + /** * Check if two area has common parts * @param a1_p pointer to an area. diff --git a/src/lv_misc/lv_mem.c b/src/lv_misc/lv_mem.c index dca4a1ab6..146eba2be 100644 --- a/src/lv_misc/lv_mem.c +++ b/src/lv_misc/lv_mem.c @@ -231,9 +231,7 @@ void * lv_mem_realloc(void * data_p, uint32_t new_size) if(old_size == new_size) return data_p; /*Also avoid reallocating the same memory*/ #if LV_MEM_CUSTOM == 0 - /* Only truncate the memory is possible - * If the 'old_size' was extended by a header size in 'ent_trunc' it avoids reallocating this - * same memory */ + /* Truncate the memory if the new size is smaller. */ if(new_size < old_size) { lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *)data_p - sizeof(lv_mem_header_t)); ent_trunc(e, new_size); diff --git a/src/lv_objx/lv_bar.c b/src/lv_objx/lv_bar.c index 11520dfef..14154fabd 100644 --- a/src/lv_objx/lv_bar.c +++ b/src/lv_objx/lv_bar.c @@ -223,7 +223,7 @@ void lv_bar_set_style(lv_obj_t * bar, lv_bar_style_t type, const lv_style_t * st case LV_BAR_STYLE_BG: lv_obj_set_style(bar, style); break; case LV_BAR_STYLE_INDIC: ext->style_indic = style; - lv_obj_refresh_ext_size(bar); + lv_obj_refresh_ext_draw_pad(bar); break; } } @@ -458,10 +458,11 @@ static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param) res = ancestor_signal(bar, sign, param); if(res != LV_RES_OK) return res; - if(sign == LV_SIGNAL_REFR_EXT_SIZE) { + + if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { const lv_style_t * style_indic = lv_bar_get_style(bar, LV_BAR_STYLE_INDIC); - if(style_indic->body.shadow.width > bar->ext_size) - bar->ext_size = style_indic->body.shadow.width; + if(style_indic->body.shadow.width > bar->ext_draw_pad) + bar->ext_draw_pad = style_indic->body.shadow.width; } else if(sign == LV_SIGNAL_GET_TYPE) { lv_obj_type_t * buf = param; uint8_t i; diff --git a/src/lv_objx/lv_chart.c b/src/lv_objx/lv_chart.c index 8c5f31b55..92b4a0b8f 100644 --- a/src/lv_objx/lv_chart.c +++ b/src/lv_objx/lv_chart.c @@ -409,7 +409,7 @@ void lv_chart_set_margin(lv_obj_t * chart, uint16_t margin) { lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); ext->margin = margin; - lv_obj_refresh_ext_size(chart); + lv_obj_refresh_ext_draw_pad(chart); } /** @@ -596,9 +596,9 @@ static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param if(buf->type[i] == NULL) break; } buf->type[i] = "lv_chart"; - } else if(sign == LV_SIGNAL_REFR_EXT_SIZE) { + } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { /*Provide extra px draw area around the chart*/ - chart->ext_size = ext->margin; + chart->ext_draw_pad = ext->margin; } return res; diff --git a/src/lv_objx/lv_ddlist.c b/src/lv_objx/lv_ddlist.c index 8f8f7622d..811108a6c 100644 --- a/src/lv_objx/lv_ddlist.c +++ b/src/lv_objx/lv_ddlist.c @@ -290,7 +290,7 @@ void lv_ddlist_set_style(lv_obj_t * ddlist, lv_ddlist_style_t type, const lv_sty case LV_DDLIST_STYLE_SEL: ext->sel_style = style; lv_obj_t * scrl = lv_page_get_scrl(ddlist); - lv_obj_refresh_ext_size(scrl); /*Because of the wider selected rectangle*/ + lv_obj_refresh_ext_draw_pad(scrl); /*Because of the wider selected rectangle*/ break; } } @@ -728,13 +728,13 @@ static lv_res_t lv_ddlist_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * lv_obj_t * ddlist = lv_obj_get_parent(scrl); - if(sign == LV_SIGNAL_REFR_EXT_SIZE) { + if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { /*TODO review this*/ /* Because of the wider selected rectangle ext. size * In this way by dragging the scrollable part the wider rectangle area can be redrawn too*/ const lv_style_t * style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_BG); - lv_coord_t hpad = LV_MATH_MAX(style->body.padding.left, style->body.padding.right); - if(scrl->ext_size < hpad) scrl->ext_size = hpad; + lv_coord_t hpad = LV_MATH_MAX(style->body.padding.left, style->body.padding.right); + if(scrl->ext_draw_pad < hpad) scrl->ext_draw_pad = hpad; } else if(sign == LV_SIGNAL_RELEASED) { if(lv_indev_is_dragging(lv_indev_get_act()) == false) { release_handler(ddlist); diff --git a/src/lv_objx/lv_label.c b/src/lv_objx/lv_label.c index e3c50d164..70ff1507c 100644 --- a/src/lv_objx/lv_label.c +++ b/src/lv_objx/lv_label.c @@ -23,8 +23,6 @@ #define LV_LABEL_DEF_SCROLL_SPEED (25) #endif -#define ANIM_WAIT_CHAR_COUNT 3 - #define LV_LABEL_DOT_END_INV 0xFFFF /********************** @@ -317,7 +315,7 @@ void lv_label_set_body_draw(lv_obj_t * label, bool en) ext->body_draw = en == false ? 0 : 1; - lv_obj_refresh_ext_size(label); + lv_obj_refresh_ext_draw_pad(label); lv_obj_invalidate(label); } @@ -774,7 +772,7 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_ /*Draw the text again next to the original to make an circular effect */ if(size.x > lv_obj_get_width(label)) { ofs.x = ext->offset.x + size.x + - lv_font_get_width(style->text.font, ' ') * ANIM_WAIT_CHAR_COUNT; + lv_font_get_width(style->text.font, ' ') * LV_LABEL_WAIT_CHAR_COUNT; ofs.y = ext->offset.y; lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ofs, ext->selection_start, ext->selection_end); @@ -824,13 +822,14 @@ static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param lv_label_revert_dots(label); lv_label_refr_text(label); } - } else if(sign == LV_SIGNAL_REFR_EXT_SIZE) { + } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { if(ext->body_draw) { const lv_style_t * style = lv_label_get_style(label); - label->ext_size = LV_MATH_MAX(label->ext_size, style->body.padding.left); - label->ext_size = LV_MATH_MAX(label->ext_size, style->body.padding.right); - label->ext_size = LV_MATH_MAX(label->ext_size, style->body.padding.top); - label->ext_size = LV_MATH_MAX(label->ext_size, style->body.padding.bottom); + + label->ext_draw_pad = LV_MATH_MAX(label->ext_draw_pad, style->body.padding.left); + label->ext_draw_pad = LV_MATH_MAX(label->ext_draw_pad, style->body.padding.right); + label->ext_draw_pad = LV_MATH_MAX(label->ext_draw_pad, style->body.padding.top); + label->ext_draw_pad = LV_MATH_MAX(label->ext_draw_pad, style->body.padding.bottom); } } else if(sign == LV_SIGNAL_GET_TYPE) { lv_obj_type_t * buf = param; @@ -883,15 +882,13 @@ static void lv_label_refr_text(lv_obj_t * label) anim.repeat = 1; anim.playback = 1; anim.start = 0; - anim.act_time = 0; anim.end_cb = NULL; anim.path = lv_anim_path_linear; anim.playback_pause = (((lv_font_get_width(style->text.font, ' ') + style->text.letter_space) * 1000) / - ext->anim_speed) * - ANIM_WAIT_CHAR_COUNT; - ; + ext->anim_speed) * LV_LABEL_WAIT_CHAR_COUNT; anim.repeat_pause = anim.playback_pause; + anim.act_time = -anim.playback_pause; bool hor_anim = false; if(size.x > lv_obj_get_width(label)) { @@ -926,7 +923,9 @@ static void lv_label_refr_text(lv_obj_t * label) anim.repeat = 1; anim.playback = 0; anim.start = 0; - anim.act_time = 0; + anim.act_time = + -(((lv_font_get_width(style->text.font, ' ') + style->text.letter_space) * 1000) / + ext->anim_speed) * LV_LABEL_WAIT_CHAR_COUNT; anim.end_cb = NULL; anim.path = lv_anim_path_linear; anim.playback_pause = 0; @@ -934,7 +933,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 = -size.x - lv_font_get_width(font, ' ') * ANIM_WAIT_CHAR_COUNT; + anim.end = -size.x - lv_font_get_width(font, ' ') * LV_LABEL_WAIT_CHAR_COUNT; 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/src/lv_objx/lv_line.c b/src/lv_objx/lv_line.c index 06bf12457..7bc714db4 100644 --- a/src/lv_objx/lv_line.c +++ b/src/lv_objx/lv_line.c @@ -295,9 +295,9 @@ static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param) if(buf->type[i] == NULL) break; } buf->type[i] = "lv_line"; - } else if(sign == LV_SIGNAL_REFR_EXT_SIZE) { + } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { const lv_style_t * style = lv_line_get_style(line); - if(line->ext_size < style->line.width) line->ext_size = style->line.width; + if(line->ext_draw_pad < style->line.width) line->ext_draw_pad = style->line.width; } return res; diff --git a/src/lv_objx/lv_lmeter.c b/src/lv_objx/lv_lmeter.c index f956412dd..563d139c9 100644 --- a/src/lv_objx/lv_lmeter.c +++ b/src/lv_objx/lv_lmeter.c @@ -340,10 +340,10 @@ static lv_res_t lv_lmeter_signal(lv_obj_t * lmeter, lv_signal_t sign, void * par if(sign == LV_SIGNAL_CLEANUP) { /*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/ } else if(sign == LV_SIGNAL_STYLE_CHG) { - lv_obj_refresh_ext_size(lmeter); - } else if(sign == LV_SIGNAL_REFR_EXT_SIZE) { + lv_obj_refresh_ext_draw_pad(lmeter); + } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { const lv_style_t * style = lv_lmeter_get_style(lmeter); - lmeter->ext_size = LV_MATH_MAX(lmeter->ext_size, style->line.width); + lmeter->ext_draw_pad = LV_MATH_MAX(lmeter->ext_draw_pad, style->line.width); } else if(sign == LV_SIGNAL_GET_TYPE) { lv_obj_type_t * buf = param; uint8_t i; diff --git a/src/lv_objx/lv_page.c b/src/lv_objx/lv_page.c index cdcf86694..1e23a969a 100644 --- a/src/lv_objx/lv_page.c +++ b/src/lv_objx/lv_page.c @@ -255,7 +255,7 @@ void lv_page_set_style(lv_obj_t * page, lv_page_style_t type, const lv_style_t * lv_area_set_height(&ext->sb.hor_area, ext->sb.style->body.padding.inner); lv_area_set_width(&ext->sb.ver_area, ext->sb.style->body.padding.inner); lv_page_sb_refresh(page); - lv_obj_refresh_ext_size(page); + lv_obj_refresh_ext_draw_pad(page); lv_obj_invalidate(page); break; case LV_PAGE_STYLE_EDGE_FLASH: ext->edge_flash.style = style; break; @@ -795,7 +795,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) if(ext->sb.hor_draw || ext->sb.ver_draw) lv_page_sb_refresh(page); /*Refresh the ext. size because the scrollbars might be positioned out of the page*/ - lv_obj_refresh_ext_size(page); + lv_obj_refresh_ext_draw_pad(page); } else if(sign == LV_SIGNAL_CORD_CHG) { /*Refresh the scrollbar and notify the scrl if the size is changed*/ if(ext->scrl != NULL && (lv_obj_get_width(page) != lv_area_get_width(param) || @@ -806,12 +806,12 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) /*The scrollbars are important only if they are visible now*/ if(ext->sb.hor_draw || ext->sb.ver_draw) lv_page_sb_refresh(page); } - } else if(sign == LV_SIGNAL_REFR_EXT_SIZE) { + } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { /*Ensure ext. size for the scrollbars if they are out of the page*/ - if(page->ext_size < (-ext->sb.style->body.padding.right)) - page->ext_size = -ext->sb.style->body.padding.right; - if(page->ext_size < (-ext->sb.style->body.padding.bottom)) - page->ext_size = -ext->sb.style->body.padding.bottom; + if(page->ext_draw_pad < (-ext->sb.style->body.padding.right)) + page->ext_draw_pad = -ext->sb.style->body.padding.right; + if(page->ext_draw_pad < (-ext->sb.style->body.padding.bottom)) + page->ext_draw_pad = -ext->sb.style->body.padding.bottom; } else if(sign == LV_SIGNAL_CONTROL) { uint32_t c = *((uint32_t *)param); diff --git a/src/lv_objx/lv_roller.c b/src/lv_objx/lv_roller.c index ffb11e72c..f27730b21 100644 --- a/src/lv_objx/lv_roller.c +++ b/src/lv_objx/lv_roller.c @@ -557,34 +557,34 @@ static void draw_bg(lv_obj_t * roller, const lv_area_t * mask) bool union_ok; lv_area_copy(&half_roller, &roller->coords); - half_roller.x1 -= roller->ext_size; /*Add ext size too (e.g. because of shadow draw) */ - half_roller.x2 += roller->ext_size; - half_roller.y1 -= roller->ext_size; + half_roller.x1 -= roller->ext_draw_pad; /*Add ext size too (e.g. because of shadow draw) */ + half_roller.x2 += roller->ext_draw_pad; + half_roller.y1 -= roller->ext_draw_pad; half_roller.y2 = roller->coords.y1 + h / 2; union_ok = lv_area_intersect(&half_mask, &half_roller, mask); - half_roller.x1 += roller->ext_size; /*Revert ext. size adding*/ - half_roller.x2 -= roller->ext_size; - half_roller.y1 += roller->ext_size; + half_roller.x1 += roller->ext_draw_pad; /*Revert ext. size adding*/ + half_roller.x2 -= roller->ext_draw_pad; + half_roller.y1 += roller->ext_draw_pad; half_roller.y2 += style->body.radius; if(union_ok) { lv_draw_rect(&half_roller, &half_mask, style, lv_obj_get_opa_scale(roller)); } - half_roller.x1 -= roller->ext_size; /*Add ext size too (e.g. because of shadow draw) */ - half_roller.x2 += roller->ext_size; - half_roller.y2 = roller->coords.y2 + roller->ext_size; + half_roller.x1 -= roller->ext_draw_pad; /*Add ext size too (e.g. because of shadow draw) */ + half_roller.x2 += roller->ext_draw_pad; + half_roller.y2 = roller->coords.y2 + roller->ext_draw_pad; half_roller.y1 = roller->coords.y1 + h / 2; if((h & 0x1) == 0) half_roller.y1++; /*With even height the pixels in the middle would be drawn twice*/ union_ok = lv_area_intersect(&half_mask, &half_roller, mask); - half_roller.x1 += roller->ext_size; /*Revert ext. size adding*/ - half_roller.x2 -= roller->ext_size; - half_roller.y2 -= roller->ext_size; + half_roller.x1 += roller->ext_draw_pad; /*Revert ext. size adding*/ + half_roller.x2 -= roller->ext_draw_pad; + half_roller.y2 -= roller->ext_draw_pad; half_roller.y1 -= style->body.radius; if(union_ok) { diff --git a/src/lv_objx/lv_slider.c b/src/lv_objx/lv_slider.c index a205a6fce..c41b49d5d 100644 --- a/src/lv_objx/lv_slider.c +++ b/src/lv_objx/lv_slider.c @@ -141,7 +141,7 @@ void lv_slider_set_style(lv_obj_t * slider, lv_slider_style_t type, const lv_sty case LV_SLIDER_STYLE_INDIC: lv_bar_set_style(slider, LV_BAR_STYLE_INDIC, style); break; case LV_SLIDER_STYLE_KNOB: ext->style_knob = style; - lv_obj_refresh_ext_size(slider); + lv_obj_refresh_ext_draw_pad(slider); break; } } @@ -533,16 +533,17 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par * During the drawing method the ext. size is used by the knob so refresh the ext. size.*/ if(lv_obj_get_width(slider) != lv_area_get_width(param) || lv_obj_get_height(slider) != lv_area_get_height(param)) { - slider->signal_cb(slider, LV_SIGNAL_REFR_EXT_SIZE, NULL); + slider->signal_cb(slider, LV_SIGNAL_REFR_EXT_DRAW_PAD, NULL); } - } else if(sign == LV_SIGNAL_REFR_EXT_SIZE) { + } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { const lv_style_t * style = lv_slider_get_style(slider, LV_SLIDER_STYLE_BG); const lv_style_t * knob_style = lv_slider_get_style(slider, LV_SLIDER_STYLE_KNOB); + lv_coord_t shadow_w = knob_style->body.shadow.width; if(ext->knob_in == 0) { /* The smaller size is the knob diameter*/ lv_coord_t x = LV_MATH_MIN(w / 2 + 1 + shadow_w, h / 2 + 1 + shadow_w); - if(slider->ext_size < x) slider->ext_size = x; + if(slider->ext_draw_pad < x) slider->ext_draw_pad = x; } else { lv_coord_t pad = 0; pad = LV_MATH_MIN(pad, style->body.padding.top); @@ -550,9 +551,9 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par pad = LV_MATH_MIN(pad, style->body.padding.left); pad = LV_MATH_MIN(pad, style->body.padding.right); if(pad < 0) pad = -pad; - if(slider->ext_size < pad) slider->ext_size = pad; + if(slider->ext_draw_pad < pad) slider->ext_draw_pad = pad; - if(slider->ext_size < shadow_w) slider->ext_size = shadow_w; + if(slider->ext_draw_pad < shadow_w) slider->ext_draw_pad = shadow_w; } } else if(sign == LV_SIGNAL_CONTROL) { char c = *((char *)param); diff --git a/src/lv_objx/lv_ta.c b/src/lv_objx/lv_ta.c index 7349ebd66..c84fa10a9 100644 --- a/src/lv_objx/lv_ta.c +++ b/src/lv_objx/lv_ta.c @@ -778,7 +778,7 @@ void lv_ta_set_style(lv_obj_t * ta, lv_ta_style_t type, const lv_style_t * style case LV_TA_STYLE_EDGE_FLASH: lv_page_set_style(ta, LV_PAGE_STYLE_EDGE_FLASH, style); break; case LV_TA_STYLE_CURSOR: ext->cursor.style = style; - lv_obj_refresh_ext_size( + lv_obj_refresh_ext_draw_pad( lv_page_get_scrl(ta)); /*Refresh ext. size because of cursor drawing*/ refr_cursor_area(ta); break; @@ -1352,11 +1352,11 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void lv_obj_t * ta = lv_obj_get_parent(scrl); lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); - if(sign == LV_SIGNAL_REFR_EXT_SIZE) { + if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { /*Set ext. size because the cursor might be out of this object*/ const lv_style_t * style_label = lv_obj_get_style(ext->label); - lv_coord_t font_h = lv_font_get_height(style_label->text.font); - scrl->ext_size = LV_MATH_MAX(scrl->ext_size, style_label->text.line_space + font_h); + lv_coord_t font_h = lv_font_get_height(style_label->text.font); + scrl->ext_draw_pad = LV_MATH_MAX(scrl->ext_draw_pad, style_label->text.line_space + font_h); } else if(sign == LV_SIGNAL_CORD_CHG) { /*Set the label width according to the text area width*/ if(ext->label) {