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

fix(gauge,linemeter) draw critical sections/end value in correct spot (#2059)

Revert be4f7a76d48112edce88d259470222aa4990ad52 and
20d56ee6e97905f56eb71d30c9a391d4b4d7eb20 as they both have issues.
This commit is contained in:
embeddedt 2021-02-08 04:45:32 -05:00 committed by GitHub
parent fd74f6985a
commit 5d3fce8208
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -112,7 +112,7 @@ static inline void lv_gauge_set_range(lv_obj_t * gauge, int32_t min, int32_t max
*/
static inline void lv_gauge_set_critical_value(lv_obj_t * gauge, int32_t value)
{
lv_linemeter_set_value(gauge, value);
lv_linemeter_set_value(gauge, value-1);
}
/**

View File

@ -446,7 +446,7 @@ void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uin
p1.y = y_out_extra;
/* Set the color of the lines */
if((!ext->mirrored && i >= level) || (ext->mirrored && i <= level)) {
if((!ext->mirrored && i > level) || (ext->mirrored && i < level)) {
line_dsc.color = end_color;
line_dsc.width = end_line_width;
}
@ -465,12 +465,12 @@ void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uin
lv_draw_mask_remove_id(mask_out_id);
#endif
if(part == LV_LINEMETER_PART_MAIN && level < ext->line_cnt - 1) {
if(part == LV_LINEMETER_PART_MAIN && level + 1 < ext->line_cnt - 1) {
lv_style_int_t border_width = lv_obj_get_style_scale_border_width(lmeter, part);
lv_style_int_t end_border_width = lv_obj_get_style_scale_end_border_width(lmeter, part);
if(border_width || end_border_width) {
int16_t end_angle = ((level) * ext->scale_angle) / (ext->line_cnt - 1) + angle_ofs;
int16_t end_angle = ((level + 1) * ext->scale_angle) / (ext->line_cnt - 1) + angle_ofs;
lv_draw_line_dsc_t arc_dsc;
lv_draw_line_dsc_init(&arc_dsc);
lv_obj_init_draw_line_dsc(lmeter, part, &arc_dsc);