Merge 20fef93fea into dev
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
- fix(arc) fix and improve arc dragging
|
- fix(arc) fix and improve arc dragging
|
||||||
- label: Repair calculate back `dot` character logical error which cause infinite loop.
|
- label: Repair calculate back `dot` character logical error which cause infinite loop.
|
||||||
- fix(theme_material): remove the bottom border from tabview header
|
- fix(theme_material): remove the bottom border from tabview header
|
||||||
|
- fix(imgbtn) guess a the closest availabe state with valid src
|
||||||
|
|
||||||
## v7.7.1 (04.11.2020)
|
## v7.7.1 (04.11.2020)
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ lv_anim_value_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_ani
|
|||||||
else
|
else
|
||||||
t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time;
|
t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time;
|
||||||
|
|
||||||
int32_t step = _lv_bezier3(t, 0, 1000, 2000, 1024);
|
int32_t step = _lv_bezier3(t, 0, 1000, 1300, 1024);
|
||||||
|
|
||||||
int32_t new_value;
|
int32_t new_value;
|
||||||
new_value = (int32_t)step * (a->end - a->start);
|
new_value = (int32_t)step * (a->end - a->start);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * clip_area, lv_design_mode_t mode);
|
static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||||
static lv_res_t lv_imgbtn_signal(lv_obj_t * imgbtn, lv_signal_t sign, void * param);
|
static lv_res_t lv_imgbtn_signal(lv_obj_t * imgbtn, lv_signal_t sign, void * param);
|
||||||
static void refr_img(lv_obj_t * imgbtn);
|
static void refr_img(lv_obj_t * imgbtn);
|
||||||
|
static lv_btn_state_t suggest_state(lv_obj_t * imgbtn, lv_btn_state_t state);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
@@ -327,7 +328,7 @@ static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * cli
|
|||||||
|
|
||||||
/*Just draw an image*/
|
/*Just draw an image*/
|
||||||
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
|
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
|
||||||
lv_btn_state_t state = lv_imgbtn_get_state(imgbtn);
|
lv_btn_state_t state = suggest_state(imgbtn, lv_imgbtn_get_state(imgbtn));
|
||||||
|
|
||||||
/*Simply draw the middle src if no tiled*/
|
/*Simply draw the middle src if no tiled*/
|
||||||
if(!ext->tiled) {
|
if(!ext->tiled) {
|
||||||
@@ -440,7 +441,6 @@ static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * cli
|
|||||||
draw_dsc.shadow_opa = LV_OPA_TRANSP;
|
draw_dsc.shadow_opa = LV_OPA_TRANSP;
|
||||||
lv_obj_init_draw_rect_dsc(imgbtn, LV_OBJ_PART_MAIN, &draw_dsc);
|
lv_obj_init_draw_rect_dsc(imgbtn, LV_OBJ_PART_MAIN, &draw_dsc);
|
||||||
|
|
||||||
|
|
||||||
lv_area_t bg_coords;
|
lv_area_t bg_coords;
|
||||||
lv_area_copy(&bg_coords, &imgbtn->coords);
|
lv_area_copy(&bg_coords, &imgbtn->coords);
|
||||||
bg_coords.x1 -= lv_obj_get_style_pad_left(imgbtn, LV_IMGBTN_PART_MAIN);
|
bg_coords.x1 -= lv_obj_get_style_pad_left(imgbtn, LV_IMGBTN_PART_MAIN);
|
||||||
@@ -501,7 +501,7 @@ static lv_res_t lv_imgbtn_signal(lv_obj_t * imgbtn, lv_signal_t sign, void * par
|
|||||||
static void refr_img(lv_obj_t * imgbtn)
|
static void refr_img(lv_obj_t * imgbtn)
|
||||||
{
|
{
|
||||||
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
|
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
|
||||||
lv_btn_state_t state = lv_imgbtn_get_state(imgbtn);
|
lv_btn_state_t state = suggest_state(imgbtn, lv_imgbtn_get_state(imgbtn));
|
||||||
lv_img_header_t header;
|
lv_img_header_t header;
|
||||||
|
|
||||||
const void * src = ext->img_src_mid[state];
|
const void * src = ext->img_src_mid[state];
|
||||||
@@ -531,4 +531,42 @@ static void refr_img(lv_obj_t * imgbtn)
|
|||||||
lv_obj_invalidate(imgbtn);
|
lv_obj_invalidate(imgbtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If `src` is not defined for the current state try to get a state which is related to the curent but has `src`.
|
||||||
|
* E.g. if the PRESSED src is not set but the RELEASED does, use the RELEASED.
|
||||||
|
* @param imgbtn pointer to an image button
|
||||||
|
* @param state the state to convert
|
||||||
|
* @return the suggested state
|
||||||
|
*/
|
||||||
|
static lv_btn_state_t suggest_state(lv_obj_t * imgbtn, lv_btn_state_t state)
|
||||||
|
{
|
||||||
|
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
|
||||||
|
if(ext->img_src_mid[state] == NULL) {
|
||||||
|
switch(state) {
|
||||||
|
case LV_BTN_STATE_PRESSED:
|
||||||
|
if(ext->img_src_mid[LV_BTN_STATE_RELEASED]) return LV_BTN_STATE_RELEASED;
|
||||||
|
break;
|
||||||
|
case LV_BTN_STATE_CHECKED_RELEASED:
|
||||||
|
if(ext->img_src_mid[LV_BTN_STATE_RELEASED]) return LV_BTN_STATE_RELEASED;
|
||||||
|
break;
|
||||||
|
case LV_BTN_STATE_CHECKED_PRESSED:
|
||||||
|
if(ext->img_src_mid[LV_BTN_STATE_CHECKED_RELEASED]) return LV_BTN_STATE_CHECKED_RELEASED;
|
||||||
|
if(ext->img_src_mid[LV_BTN_STATE_PRESSED]) return LV_BTN_STATE_PRESSED;
|
||||||
|
if(ext->img_src_mid[LV_BTN_STATE_RELEASED]) return LV_BTN_STATE_RELEASED;
|
||||||
|
break;
|
||||||
|
case LV_BTN_STATE_DISABLED:
|
||||||
|
if(ext->img_src_mid[LV_BTN_STATE_RELEASED]) return LV_BTN_STATE_RELEASED;
|
||||||
|
break;
|
||||||
|
case LV_BTN_STATE_CHECKED_DISABLED:
|
||||||
|
if(ext->img_src_mid[LV_BTN_STATE_CHECKED_RELEASED]) return LV_BTN_STATE_CHECKED_RELEASED;
|
||||||
|
if(ext->img_src_mid[LV_BTN_STATE_RELEASED]) return LV_BTN_STATE_RELEASED;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -250,9 +250,13 @@ bool lv_list_remove(const lv_obj_t * list, uint16_t index)
|
|||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
|
||||||
|
|
||||||
|
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||||
uint16_t count = 0;
|
uint16_t count = 0;
|
||||||
lv_obj_t * e = lv_list_get_next_btn(list, NULL);
|
lv_obj_t * e = lv_list_get_next_btn(list, NULL);
|
||||||
while(e != NULL) {
|
while(e != NULL) {
|
||||||
|
if(e == ext->last_sel_btn) ext->last_sel_btn = NULL;
|
||||||
|
if(e == ext->act_sel_btn) ext->act_sel_btn = NULL;
|
||||||
|
|
||||||
if(count == index) {
|
if(count == index) {
|
||||||
lv_obj_del(e);
|
lv_obj_del(e);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user