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

lv_bar and lv_slider: fix indicator size at amy value

This commit is contained in:
Gabor Kiss-Vamosi 2018-10-12 21:11:55 +02:00
parent 4cf6a4c22e
commit a482132652
2 changed files with 8 additions and 8 deletions

View File

@ -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*/

View File

@ -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);