BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lvgl
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
lvgl
Commits
2f896ab0
Commit
2f896ab0
authored
Nov 21, 2017
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slider knob shadow bugfix
parent
9d2d7ee8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
14 deletions
+52
-14
lv_slider.c
lv_objx/lv_slider.c
+5
-2
lv_theme_night.c
lv_themes/lv_theme_night.c
+47
-12
No files found.
lv_objx/lv_slider.c
View file @
2f896ab0
...
...
@@ -400,16 +400,19 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
slider
->
signal_func
(
slider
,
LV_SIGNAL_REFR_EXT_SIZE
,
NULL
);
}
}
else
if
(
sign
==
LV_SIGNAL_REFR_EXT_SIZE
)
{
lv_style_t
*
style
=
lv_slider_get_style
(
slider
,
LV_SLIDER_STYLE_BG
);
lv_style_t
*
knob_style
=
lv_slider_get_style
(
slider
,
LV_SLIDER_STYLE_KNOB
);
cord_t
shadow_w
=
knob_style
->
body
.
shadow
.
width
;
if
(
ext
->
knob_in
==
0
)
{
cord_t
x
=
MATH_MIN
(
w
/
2
,
h
/
2
);
/*The smaller size is the knob diameter*/
cord_t
x
=
MATH_MIN
(
w
/
2
+
shadow_w
,
h
/
2
+
shadow_w
);
/*The smaller size is the knob diameter*/
if
(
slider
->
ext_size
<
x
)
slider
->
ext_size
=
x
;
}
else
{
lv_style_t
*
style
=
lv_obj_get_style
(
slider
);
cord_t
pad
=
MATH_MIN
(
style
->
body
.
padding
.
hor
,
style
->
body
.
padding
.
ver
);
if
(
pad
<
0
)
{
pad
=
-
pad
;
if
(
slider
->
ext_size
<
pad
)
slider
->
ext_size
=
pad
;
}
if
(
slider
->
ext_size
<
shadow_w
)
slider
->
ext_size
=
shadow_w
;
}
}
else
if
(
sign
==
LV_SIGNAL_CONTROLL
)
{
lv_slider_ext_t
*
ext
=
lv_obj_get_ext_attr
(
slider
);
...
...
lv_themes/lv_theme_night.c
View file @
2f896ab0
...
...
@@ -38,8 +38,6 @@ static lv_style_t btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina;
static
lv_style_t
bar_bg
,
bar_indic
;
static
lv_style_t
slider_knob
;
static
lv_style_t
ddlist_bg
,
ddlist_sel
;
static
lv_style_t
roller_bg
;
static
lv_style_t
list_bg
,
list_btn_rel
,
list_btn_pr
;
/*Saved input parameters*/
static
uint16_t
_hue
;
...
...
@@ -58,9 +56,9 @@ static void basic_init(void)
lv_style_copy
(
&
def
,
&
lv_style_pretty
);
/*Initialize the default style*/
lv_style_copy
(
&
bg
,
&
lv_style_plain
);
bg
.
body
.
main_color
=
color_hsv_to_rgb
(
_hue
,
11
,
23
);
bg
.
body
.
grad_color
=
color_hsv_to_rgb
(
_hue
,
11
,
23
);
bg
.
body
.
main_color
=
color_hsv_to_rgb
(
_hue
,
11
,
30
);
bg
.
body
.
grad_color
=
color_hsv_to_rgb
(
_hue
,
11
,
30
);
bg
.
text
.
color
=
color_hsv_to_rgb
(
_hue
,
5
,
95
);
theme
.
bg
=
&
bg
;
theme
.
panel
=
&
def
;
...
...
@@ -75,7 +73,12 @@ static void btn_init(void)
btn_rel
.
body
.
grad_color
=
color_hsv_to_rgb
(
_hue
,
10
,
20
);
btn_rel
.
body
.
border
.
color
=
COLOR_HEX3
(
0x111
);
btn_rel
.
body
.
border
.
width
=
1
<<
LV_AA
;
btn_rel
.
body
.
border
.
opa
=
OPA_COVER
;
btn_rel
.
body
.
border
.
opa
=
OPA_80
;
btn_rel
.
body
.
padding
.
hor
=
LV_DPI
/
4
;
btn_rel
.
body
.
padding
.
ver
=
LV_DPI
/
8
;
btn_rel
.
body
.
shadow
.
type
=
LV_SHADOW_BOTTOM
;
btn_rel
.
body
.
shadow
.
color
=
COLOR_HEX3
(
0x111
);
btn_rel
.
body
.
shadow
.
width
=
LV_DPI
/
20
;
btn_rel
.
text
.
color
=
COLOR_HEX3
(
0xeee
);
lv_style_copy
(
&
btn_pr
,
&
btn_rel
);
...
...
@@ -85,15 +88,20 @@ static void btn_init(void)
lv_style_copy
(
&
btn_tgl_rel
,
&
btn_rel
);
btn_tgl_rel
.
body
.
main_color
=
color_hsv_to_rgb
(
_hue
,
10
,
20
);
btn_tgl_rel
.
body
.
grad_color
=
color_hsv_to_rgb
(
_hue
,
10
,
40
);
btn_tgl_rel
.
body
.
shadow
.
width
=
LV_DPI
/
30
;
btn_tgl_rel
.
text
.
color
=
COLOR_HEX3
(
0xddd
);
lv_style_copy
(
&
btn_tgl_pr
,
&
btn_rel
);
btn_tgl_pr
.
body
.
main_color
=
color_hsv_to_rgb
(
_hue
,
10
,
10
);
btn_tgl_pr
.
body
.
grad_color
=
color_hsv_to_rgb
(
_hue
,
10
,
30
);
btn_tgl_pr
.
body
.
shadow
.
width
=
LV_DPI
/
30
;
btn_tgl_pr
.
text
.
color
=
COLOR_HEX3
(
0xddd
);
lv_style_copy
(
&
btn_ina
,
&
btn_rel
);
btn_ina
.
body
.
main_color
=
color_hsv_to_rgb
(
_hue
,
10
,
20
);
btn_ina
.
body
.
grad_color
=
color_hsv_to_rgb
(
_hue
,
10
,
20
);
btn_ina
.
text
.
color
=
COLOR_HEX3
(
0xaaa
);
btn_ina
.
body
.
shadow
.
width
=
0
;
theme
.
btn
.
rel
=
&
btn_rel
;
theme
.
btn
.
pr
=
&
btn_pr
;
...
...
@@ -341,29 +349,55 @@ static void ta_init(void)
static
void
list_init
(
void
)
{
#if USE_LV_LIST != 0
static
lv_style_t
list_bg
,
list_btn_rel
,
list_btn_pr
,
list_btn_tgl_rel
,
list_btn_tgl_pr
;
lv_style_copy
(
&
list_bg
,
&
bg
);
list_bg
.
body
.
main_color
=
color_hsv_to_rgb
(
_hue
,
1
0
,
15
);
list_bg
.
body
.
grad_color
=
color_hsv_to_rgb
(
_hue
,
1
0
,
15
);
list_bg
.
body
.
main_color
=
color_hsv_to_rgb
(
_hue
,
1
1
,
18
);
list_bg
.
body
.
grad_color
=
color_hsv_to_rgb
(
_hue
,
1
1
,
18
);
list_bg
.
body
.
radius
=
LV_DPI
/
30
;
list_bg
.
body
.
border
.
color
=
color_hsv_to_rgb
(
_hue
,
10
,
10
);
list_bg
.
body
.
border
.
width
=
1
<<
LV_AA
;
list_bg
.
body
.
border
.
opa
=
OPA_COVER
;
list_bg
.
body
.
padding
.
ver
=
LV_DPI
/
20
;
list_bg
.
body
.
padding
.
ver
=
0
;
list_bg
.
body
.
padding
.
hor
=
0
;
lv_style_copy
(
&
list_btn_rel
,
&
bg
);
list_btn_rel
.
body
.
empty
=
1
;
list_btn_rel
.
body
.
border
.
part
=
LV_BORDER_BOTTOM
;
list_btn_rel
.
body
.
border
.
color
=
color_hsv_to_rgb
(
_hue
,
10
,
5
);
list_btn_rel
.
body
.
border
.
width
=
1
<<
LV_AA
;
list_btn_rel
.
body
.
radius
=
LV_DPI
/
10
;
list_btn_rel
.
text
.
color
=
color_hsv_to_rgb
(
_hue
,
5
,
80
);
list_btn_rel
.
body
.
padding
.
ver
=
LV_DPI
/
10
;
list_btn_rel
.
body
.
padding
.
hor
=
LV_DPI
/
10
;
lv_style_copy
(
&
list_btn_pr
,
&
btn_pr
);
list_btn_pr
.
body
.
main_color
=
btn_pr
.
body
.
grad_color
;
list_btn_pr
.
body
.
grad_color
=
btn_pr
.
body
.
main_color
;
list_btn_pr
.
body
.
border
.
color
=
color_hsv_to_rgb
(
_hue
,
10
,
5
);
list_btn_pr
.
body
.
border
.
width
=
0
;
list_btn_pr
.
body
.
radius
=
LV_DPI
/
30
;
list_btn_pr
.
body
.
padding
.
ver
=
LV_DPI
/
10
;
list_btn_pr
.
body
.
padding
.
hor
=
LV_DPI
/
10
;
list_btn_pr
.
text
.
color
=
color_hsv_to_rgb
(
_hue
,
5
,
80
);
lv_style_copy
(
&
list_btn_tgl_rel
,
&
list_btn_rel
);
list_btn_tgl_rel
.
body
.
empty
=
0
;
list_btn_tgl_rel
.
body
.
main_color
=
color_hsv_to_rgb
(
_hue
,
10
,
8
);
list_btn_tgl_rel
.
body
.
grad_color
=
color_hsv_to_rgb
(
_hue
,
10
,
8
);
list_btn_tgl_rel
.
body
.
radius
=
LV_DPI
/
30
;
lv_style_copy
(
&
list_btn_tgl_pr
,
&
list_btn_tgl_rel
);
list_btn_tgl_pr
.
body
.
main_color
=
btn_tgl_pr
.
body
.
main_color
;
list_btn_tgl_pr
.
body
.
grad_color
=
btn_tgl_pr
.
body
.
grad_color
;
theme
.
list
.
sb
=
&
def
;
theme
.
list
.
bg
=
&
list_bg
;
theme
.
list
.
scrl
=
&
lv_style_transp_tight
;
theme
.
list
.
btn
.
rel
=
&
list_btn_rel
;
theme
.
list
.
btn
.
pr
=
&
def
;
theme
.
list
.
btn
.
tgl_rel
=
&
def
;
theme
.
list
.
btn
.
tgl_pr
=
&
def
;
theme
.
list
.
btn
.
pr
=
&
list_btn_pr
;
theme
.
list
.
btn
.
tgl_rel
=
&
list_btn_tgl_rel
;
theme
.
list
.
btn
.
tgl_pr
=
&
list_btn_tgl_pr
;
theme
.
list
.
btn
.
ina
=
&
def
;
#endif
}
...
...
@@ -391,6 +425,7 @@ static void ddlist_init(void)
static
void
roller_init
(
void
)
{
#if USE_LV_ROLLER != 0
static
lv_style_t
roller_bg
;
lv_style_copy
(
&
roller_bg
,
&
ddlist_bg
);
roller_bg
.
body
.
main_color
=
color_hsv_to_rgb
(
_hue
,
10
,
20
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment