mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
lv_slider: draw greater background on negative padding if knob_in == 1
This commit is contained in:
parent
68d262ba93
commit
89b5907eb6
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user