Update lv_btnm.c

Attempt to fix an LV_BORDER_RIGHT drawing issue.
This commit is contained in:
Samuel
2018-12-12 11:30:17 +08:00
committed by GitHub
parent e5dabf716a
commit 49b136191f

View File

@@ -437,7 +437,6 @@ static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mo
lv_area_t area_tmp;
lv_coord_t btn_w;
lv_coord_t btn_h;
bool border_mod = false;
uint16_t btn_i = 0;
uint16_t txt_i = 0;
@@ -465,21 +464,8 @@ static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mo
else if(btn_i == ext->btn_id_pr && btn_i == ext->btn_id_tgl) btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_TGL_PR);
else btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_REL); /*Not possible option, just to be sure*/
/*On the right buttons clear the border if only right borders are drawn*/
if(ext->map_p[txt_i + 1][0] == '\0' || ext->map_p[txt_i + 1][0] == '\n') {
if(btn_style->body.border.part == LV_BORDER_RIGHT) {
btn_style->body.border.part = LV_BORDER_NONE;
border_mod = true;
}
}
lv_draw_rect(&area_tmp, mask, btn_style, opa_scale);
if(border_mod) {
border_mod = false;
btn_style->body.border.part = LV_BORDER_RIGHT;
}
/*Calculate the size of the text*/
if(btn_style->glass) btn_style = bg_style;
const lv_font_t * font = btn_style->text.font;
@@ -493,7 +479,6 @@ static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mo
area_tmp.x2 = area_tmp.x1 + txt_size.x;
area_tmp.y2 = area_tmp.y1 + txt_size.y;
lv_draw_label(&area_tmp, mask, btn_style, opa_scale, ext->map_p[txt_i], LV_TXT_FLAG_NONE, NULL);
}
}