Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kayak UI
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Bevy Forks
Kayak UI
Commits
527644f3
Commit
527644f3
authored
3 years ago
by
Gino Valente
Browse files
Options
Downloads
Patches
Plain Diff
Removed default cursor on Text widget
Added show_cursor prop on Text widget to achieve same effect
parent
bd9786d5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/widgets/text.rs
+9
-4
9 additions, 4 deletions
src/widgets/text.rs
with
9 additions
and
4 deletions
src/widgets/text.rs
+
9
−
4
View file @
527644f3
...
@@ -15,6 +15,10 @@ pub struct TextProps {
...
@@ -15,6 +15,10 @@ pub struct TextProps {
pub
font
:
Option
<
String
>
,
pub
font
:
Option
<
String
>
,
/// The height of a line of text (currently in pixels)
/// The height of a line of text (currently in pixels)
pub
line_height
:
Option
<
f32
>
,
pub
line_height
:
Option
<
f32
>
,
/// If true, displays the default text cursor when hovered.
///
/// This _will_ override `cursor` values set by styles.
pub
show_cursor
:
bool
,
/// The font size (in pixels)
/// The font size (in pixels)
///
///
/// Negative values have no effect
/// Negative values have no effect
...
@@ -35,6 +39,7 @@ impl Default for TextProps {
...
@@ -35,6 +39,7 @@ impl Default for TextProps {
content
:
String
::
new
(),
content
:
String
::
new
(),
font
:
None
,
font
:
None
,
line_height
:
None
,
line_height
:
None
,
show_cursor
:
false
,
size
:
-
1.0
,
size
:
-
1.0
,
styles
:
None
,
styles
:
None
,
on_event
:
None
,
on_event
:
None
,
...
@@ -70,6 +75,9 @@ pub fn Text(props: TextProps) {
...
@@ -70,6 +75,9 @@ pub fn Text(props: TextProps) {
if
let
Some
(
ref
font
)
=
props
.font
{
if
let
Some
(
ref
font
)
=
props
.font
{
styles
.font
=
StyleProp
::
Value
(
font
.clone
());
styles
.font
=
StyleProp
::
Value
(
font
.clone
());
}
}
if
props
.show_cursor
{
styles
.cursor
=
StyleProp
::
Value
(
CursorIcon
::
Text
);
}
if
props
.size
>=
0.0
{
if
props
.size
>=
0.0
{
styles
.font_size
=
StyleProp
::
Value
(
props
.size
);
styles
.font_size
=
StyleProp
::
Value
(
props
.size
);
}
}
...
@@ -77,8 +85,5 @@ pub fn Text(props: TextProps) {
...
@@ -77,8 +85,5 @@ pub fn Text(props: TextProps) {
styles
.line_height
=
StyleProp
::
Value
(
line_height
);
styles
.line_height
=
StyleProp
::
Value
(
line_height
);
}
}
props
.styles
=
Some
(
styles
.with_style
(
&
props
.styles
)
.with_style
(
Style
{
props
.styles
=
Some
(
styles
.with_style
(
&
props
.styles
));
cursor
:
StyleProp
::
Value
(
CursorIcon
::
Text
),
..
Default
::
default
()
}));
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment