From a482132652152a920ff4767b01824ff071d24895 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 12 Oct 2018 21:11:55 +0200 Subject: [PATCH] lv_bar and lv_slider: fix indicator size at amy value --- lv_objx/lv_bar.c | 8 ++++---- lv_objx/lv_slider.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lv_objx/lv_bar.c b/lv_objx/lv_bar.c index 454aba4bb..46ca9bd1a 100644 --- a/lv_objx/lv_bar.c +++ b/lv_objx/lv_bar.c @@ -317,11 +317,11 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode lv_coord_t h = lv_area_get_height(&indic_area); if(w >= h) { - indic_area.x2 = (int32_t)((int32_t)w * (ext->cur_value - ext->min_value - 1)) / (ext->max_value - ext->min_value); - indic_area.x2 = indic_area.x1 + indic_area.x2; + indic_area.x2 = (int32_t)((int32_t)w * (ext->cur_value - ext->min_value)) / (ext->max_value - ext->min_value); + indic_area.x2 = indic_area.x1 + indic_area.x2 - 1; } else { - indic_area.y1 = (int32_t)((int32_t)h * (ext->cur_value - ext->min_value - 1)) / (ext->max_value - ext->min_value); - indic_area.y1 = indic_area.y2 - indic_area.y1; + indic_area.y1 = (int32_t)((int32_t)h * (ext->cur_value - ext->min_value)) / (ext->max_value - ext->min_value); + indic_area.y1 = indic_area.y2 - indic_area.y1 + 1; } /*Draw the indicator*/ diff --git a/lv_objx/lv_slider.c b/lv_objx/lv_slider.c index 857bb61bd..71e4b4162 100644 --- a/lv_objx/lv_slider.c +++ b/lv_objx/lv_slider.c @@ -349,12 +349,12 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig if(ext->drag_value != LV_SLIDER_NOT_PRESSED) cur_value = ext->drag_value; if(slider_w >= slider_h) { - area_indic.x2 = (int32_t)((int32_t)(lv_area_get_width(&area_indic) - 1) * (cur_value - min_value)) / (max_value - min_value); - area_indic.x2 = area_indic.x1 + area_indic.x2; + area_indic.x2 = (int32_t)((int32_t)(lv_area_get_width(&area_indic)) * (cur_value - min_value)) / (max_value - min_value); + area_indic.x2 = area_indic.x1 + area_indic.x2 - 1; } else { - area_indic.y1 = (int32_t)((int32_t)(lv_area_get_height(&area_indic) - 1) * (cur_value - min_value)) / (max_value - min_value); - area_indic.y1 = area_indic.y2 - area_indic.y1; + area_indic.y1 = (int32_t)((int32_t)(lv_area_get_height(&area_indic)) * (cur_value - min_value)) / (max_value - min_value); + area_indic.y1 = area_indic.y2 - area_indic.y1 + 1; } if(cur_value != min_value) lv_draw_rect(&area_indic, mask, style_indic, opa_scale);