1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

gauge: make the needle images to use the styles from LV_GAUGE_PART_PART

This commit is contained in:
Gabor Kiss-Vamosi 2020-10-28 11:13:51 +01:00
parent b3cca917df
commit 85c8014880
2 changed files with 10 additions and 7 deletions

View File

@ -3,6 +3,7 @@
## v7.7.1 (04.11.2020)
### Bugfixes
- Respect btnmatrix's `one_check` in `lv_btnmatrix_set_btn_ctrl`
- Gauge: make the needle images to use the styles from `LV_GAUGE_PART_PART`
## v7.7.0 (20.10.2020)

View File

@ -586,8 +586,14 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * clip_area)
uint8_t i;
lv_draw_line_dsc_t line_dsc;
lv_draw_line_dsc_init(&line_dsc);
lv_obj_init_draw_line_dsc(gauge, LV_GAUGE_PART_NEEDLE, &line_dsc);
lv_draw_img_dsc_t img_dsc;
if(ext->needle_img == NULL) {
lv_draw_line_dsc_init(&line_dsc);
lv_obj_init_draw_line_dsc(gauge, LV_GAUGE_PART_NEEDLE, &line_dsc);
} else {
lv_draw_img_dsc_init(&img_dsc);
lv_obj_init_draw_img_dsc(gauge, LV_GAUGE_PART_NEEDLE, &img_dsc);
}
p_mid.x = x_ofs;
p_mid.y = y_ofs;
@ -616,14 +622,10 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * clip_area)
a.y1 = gauge->coords.y1 + lv_area_get_height(&gauge->coords) / 2 - ext->needle_img_pivot.y;
a.x2 = a.x1 + info.w - 1;
a.y2 = a.y1 + info.h - 1;
lv_draw_img_dsc_t img_dsc;
lv_draw_img_dsc_init(&img_dsc);
lv_obj_init_draw_img_dsc(gauge, LV_GAUGE_PART_MAIN, &img_dsc);
img_dsc.pivot.x = ext->needle_img_pivot.x;
img_dsc.pivot.y = ext->needle_img_pivot.y;
if(ext->needle_colors != NULL)
img_dsc.recolor = ext->needle_colors[i];
if(ext->needle_colors != NULL) img_dsc.recolor = ext->needle_colors[i];
needle_angle = (needle_angle * 10);
if(needle_angle > 3600) needle_angle -= 3600;