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
446c86a3
Commit
446c86a3
authored
Jan 04, 2017
by
Gabor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv_page: sb mode drag added (now auto means show sb if scrolling is possible)
parent
9aba30ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
lv_page.c
lv_objx/lv_page.c
+10
-4
lv_page.h
lv_objx/lv_page.h
+2
-1
No files found.
lv_objx/lv_page.c
View file @
446c86a3
...
...
@@ -278,7 +278,7 @@ static bool lv_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void* param)
break
;
case
LV_SIGNAL_DRAG_BEGIN
:
if
(
style
->
sb_mode
==
LV_PAGE_SB_MODE_
AUTO
)
{
if
(
style
->
sb_mode
==
LV_PAGE_SB_MODE_
DRAG
)
{
cord_t
sbh_pad
=
max
(
style
->
sb_width
,
style
->
bg_rects
.
hpad
);
cord_t
sbv_pad
=
max
(
style
->
sb_width
,
style
->
bg_rects
.
vpad
);
area_t
sb_area_tmp
;
...
...
@@ -292,9 +292,7 @@ static bool lv_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void* param)
break
;
case
LV_SIGNAL_DRAG_END
:
if
(
style
->
sb_mode
==
LV_PAGE_SB_MODE_AUTO
)
{
page_ext
->
sbh_draw
=
0
;
page_ext
->
sbv_draw
=
0
;
if
(
style
->
sb_mode
==
LV_PAGE_SB_MODE_DRAG
)
{
area_t
sb_area_tmp
;
if
(
page_ext
->
sbh_draw
!=
0
)
{
area_cpy
(
&
sb_area_tmp
,
&
page_ext
->
sbh
);
...
...
@@ -303,6 +301,7 @@ static bool lv_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void* param)
sb_area_tmp
.
x2
+=
page
->
cords
.
x2
;
sb_area_tmp
.
y2
+=
page
->
cords
.
y2
;
lv_inv_area
(
&
sb_area_tmp
);
page_ext
->
sbh_draw
=
0
;
}
if
(
page_ext
->
sbv_draw
!=
0
)
{
area_cpy
(
&
sb_area_tmp
,
&
page_ext
->
sbv
);
...
...
@@ -311,6 +310,7 @@ static bool lv_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void* param)
sb_area_tmp
.
x2
+=
page
->
cords
.
x2
;
sb_area_tmp
.
y2
+=
page
->
cords
.
y2
;
lv_inv_area
(
&
sb_area_tmp
);
page_ext
->
sbv_draw
=
0
;
}
}
break
;
...
...
@@ -601,6 +601,7 @@ static void lv_page_sb_refresh(lv_obj_t * page)
if
(
scrl_w
<=
obj_w
-
2
*
hpad
)
{
/*Full sized scroll bar*/
area_set_width
(
&
page_ext
->
sbh
,
obj_w
-
2
*
sbh_pad
);
area_set_pos
(
&
page_ext
->
sbh
,
sbh_pad
,
obj_h
-
style
->
sb_width
);
if
(
style
->
sb_mode
==
LV_PAGE_SB_MODE_AUTO
)
page_ext
->
sbh_draw
=
0
;
}
else
{
size_tmp
=
(
obj_w
*
(
obj_w
-
(
2
*
sbh_pad
)))
/
(
scrl_w
+
2
*
hpad
);
area_set_width
(
&
page_ext
->
sbh
,
size_tmp
);
...
...
@@ -608,12 +609,15 @@ static void lv_page_sb_refresh(lv_obj_t * page)
area_set_pos
(
&
page_ext
->
sbh
,
sbh_pad
+
(
-
(
lv_obj_get_x
(
scrl
)
-
hpad
)
*
(
obj_w
-
size_tmp
-
2
*
sbh_pad
))
/
(
scrl_w
+
2
*
hpad
-
obj_w
),
obj_h
-
style
->
sb_width
);
if
(
style
->
sb_mode
==
LV_PAGE_SB_MODE_AUTO
)
page_ext
->
sbh_draw
=
1
;
}
/*Vertical scrollbar*/
if
(
scrl_h
<=
obj_h
-
2
*
vpad
)
{
/*Full sized scroll bar*/
area_set_height
(
&
page_ext
->
sbv
,
obj_h
-
2
*
sbv_pad
);
area_set_pos
(
&
page_ext
->
sbv
,
obj_w
-
style
->
sb_width
,
sbv_pad
);
if
(
style
->
sb_mode
==
LV_PAGE_SB_MODE_AUTO
)
page_ext
->
sbv_draw
=
0
;
}
else
{
size_tmp
=
(
obj_h
*
(
obj_h
-
(
2
*
sbv_pad
)))
/
(
scrl_h
+
2
*
vpad
);
area_set_height
(
&
page_ext
->
sbv
,
size_tmp
);
...
...
@@ -622,6 +626,8 @@ static void lv_page_sb_refresh(lv_obj_t * page)
sbv_pad
+
(
-
(
lv_obj_get_y
(
scrl
)
-
vpad
)
*
(
obj_h
-
size_tmp
-
2
*
sbv_pad
))
/
(
scrl_h
+
2
*
vpad
-
obj_h
));
if
(
style
->
sb_mode
==
LV_PAGE_SB_MODE_AUTO
)
page_ext
->
sbv_draw
=
1
;
}
/*Invalidate the new scrollbar areas*/
...
...
lv_objx/lv_page.h
View file @
446c86a3
...
...
@@ -31,7 +31,8 @@ typedef enum
{
LV_PAGE_SB_MODE_OFF
,
LV_PAGE_SB_MODE_ON
,
LV_PAGE_SB_MODE_AUTO
,
LV_PAGE_SB_MODE_DRAG
,
LV_PAGE_SB_MODE_AUTO
,
}
lv_page_sb_mode_t
;
...
...
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