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
74800973
Commit
74800973
authored
Oct 09, 2017
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv_ta: apply hpad/vpad on cursor position/size
parent
577fc7b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
lv_ta.c
lv_objx/lv_ta.c
+20
-16
No files found.
lv_objx/lv_ta.c
View file @
74800973
...
...
@@ -866,6 +866,8 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
cur_style
.
radius
=
0
;
cur_style
.
empty
=
0
;
cur_style
.
opa
=
OPA_COVER
;
cur_style
.
hpad
=
0
;
cur_style
.
vpad
=
0
;
}
uint16_t
cur_pos
=
lv_ta_get_cursor_pos
(
ta
);
...
...
@@ -911,16 +913,16 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
/*Draw he cursor according to the type*/
area_t
cur_area
;
if
(
ta_ext
->
cursor_type
==
LV_TA_CURSOR_LINE
)
{
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
-
(
cur_style
.
line_width
>>
1
)
-
(
cur_style
.
line_width
&
0x1
);
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
(
cur_style
.
line_width
>>
1
);
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
letter_h
;
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
cur_style
.
hpad
-
(
cur_style
.
line_width
>>
1
)
-
(
cur_style
.
line_width
&
0x1
);
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
cur_style
.
vpad
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
cur_style
.
hpad
+
(
cur_style
.
line_width
>>
1
);
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
cur_style
.
vpad
+
letter_h
;
lv_draw_rect
(
&
cur_area
,
mask
,
&
cur_style
);
}
else
if
(
ta_ext
->
cursor_type
==
LV_TA_CURSOR_BLOCK
)
{
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
letter_h
;
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
-
cur_style
.
hpad
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
-
cur_style
.
vpad
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
cur_style
.
hpad
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
cur_style
.
vpad
+
letter_h
;
lv_draw_rect
(
&
cur_area
,
mask
,
&
cur_style
);
...
...
@@ -933,22 +935,24 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
char
letter_buf
[
8
]
=
{
0
};
memcpy
(
letter_buf
,
&
txt
[
byte_pos
],
txt_utf8_size
(
txt
[
byte_pos
]));
#endif
cur_area
.
x1
+=
cur_style
.
hpad
;
cur_area
.
y1
+=
cur_style
.
vpad
;
lv_draw_label
(
&
cur_area
,
mask
,
&
cur_style
,
letter_buf
,
TXT_FLAG_NONE
,
0
);
}
else
if
(
ta_ext
->
cursor_type
==
LV_TA_CURSOR_OUTLINE
)
{
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
letter_h
;
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
-
cur_style
.
hpad
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
-
cur_style
.
vpad
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
cur_style
.
hpad
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
-
cur_style
.
vpad
+
letter_h
;
cur_style
.
empty
=
1
;
if
(
cur_style
.
bwidth
==
0
)
cur_style
.
bwidth
=
1
*
LV_DOWNSCALE
;
/*Be sure the border will be drawn*/
lv_draw_rect
(
&
cur_area
,
mask
,
&
cur_style
);
}
else
if
(
ta_ext
->
cursor_type
==
LV_TA_CURSOR_UNDERLINE
)
{
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
letter_h
-
(
cur_style
.
line_width
>>
1
);
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
letter_h
+
(
cur_style
.
line_width
>>
1
)
+
(
cur_style
.
line_width
&
0x1
);
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
cur_style
.
hpad
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
cur_style
.
vpad
+
letter_h
-
(
cur_style
.
line_width
>>
1
);
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
cur_style
.
hpad
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
cur_style
.
vpad
+
letter_h
+
(
cur_style
.
line_width
>>
1
)
+
(
cur_style
.
line_width
&
0x1
);
lv_draw_rect
(
&
cur_area
,
mask
,
&
cur_style
);
}
...
...
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