BigW Consortium Gitlab

Commit 89b5907e by Gabor Kiss-Vamosi

lv_slider: draw greater background on negative padding if knob_in == 1

parent 68d262ba
......@@ -273,11 +273,21 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
pad_hor_bg = (lv_area_get_width(&area_bg) - LV_SLIDER_SIZE_MIN) >> 1;
}
/*Let space only in the perpendicular directions*/
area_bg.x1 += slider_w < slider_h ? pad_hor_bg : 0; /*Pad only for vertical slider*/
area_bg.x2 -= slider_w < slider_h ? pad_hor_bg : 0; /*Pad only for vertical slider*/
area_bg.y1 += slider_w > slider_h ? pad_ver_bg : 0; /*Pad only for horizontal slider*/
area_bg.y2 -= slider_w > slider_h ? pad_ver_bg : 0; /*Pad only for horizontal slider*/
if(ext->knob_in) { /*Enable extra size if the knob is inside */
if(pad_hor_bg < 0) {
area_bg.x1 += pad_hor_bg;
area_bg.x2 -= pad_hor_bg;
}
if(pad_ver_bg < 0) {
area_bg.y1 += pad_hor_bg;
area_bg.y2 -= pad_hor_bg;
}
} else { /*Let space only in the perpendicular directions*/
area_bg.x1 += slider_w < slider_h ? pad_hor_bg : 0; /*Pad only for vertical slider*/
area_bg.x2 -= slider_w < slider_h ? pad_hor_bg : 0; /*Pad only for vertical slider*/
area_bg.y1 += slider_w > slider_h ? pad_ver_bg : 0; /*Pad only for horizontal slider*/
area_bg.y2 -= slider_w > slider_h ? pad_ver_bg : 0; /*Pad only for horizontal slider*/
}
lv_draw_rect(&area_bg, mask, style_bg);
/*Draw the indicator*/
......
......@@ -366,9 +366,9 @@ static void gauge_init(void)
lv_style_copy(&gauge_bg, &def);
gauge_bg.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 70);
gauge_bg.body.grad_color = gauge_bg.body.main_color;
gauge_bg.body.padding.hor = LV_DPI / 12; /*Scale line length*/
gauge_bg.body.padding.hor = LV_DPI / 16; /*Scale line length*/
gauge_bg.body.padding.ver = LV_DPI / 10; /*Needle center size*/
gauge_bg.body.padding.inner = LV_DPI / 8; /*Label - scale distance*/
gauge_bg.body.padding.inner = LV_DPI / 12; /*Label - scale distance*/
gauge_bg.body.border.color = LV_COLOR_HEX3(0x777);
gauge_bg.line.color = lv_color_hsv_to_rgb(_hue, 80, 75);
gauge_bg.line.width = 2;
......
......@@ -283,10 +283,10 @@ static void gauge_init(void)
lv_style_copy(&gauge, &def);
gauge.line.color = lv_color_hsv_to_rgb(_hue, 50, 70);
gauge.line.width = 2;
gauge.line.width = 1;
gauge.body.main_color = LV_COLOR_HEX3(0x999);
gauge.body.grad_color = gauge.body.main_color;
gauge.body.padding.hor = LV_DPI / 12;
gauge.body.padding.hor = LV_DPI / 16;
gauge.body.border.color = LV_COLOR_HEX3(0x666); /*Needle middle color*/
theme.gauge = &gauge;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment