Skip to content

Commit d7b66e8

Browse files
authored
chore: update scrolling example description/screenshot (#171)
1 parent 774bd2f commit d7b66e8

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ To run any of the examples, use `cargo run --example NAME`. For example, to run
1717
|[hello_world.rs](./hello_world.rs)<br />Hello, world!|![preview](./images/hello-world.png)|
1818
|[overlap.rs](./overlap.rs)<br />Uses absolute positioning to create overlapping elements.|![preview](./images/overlap.png)|
1919
|[progress_bar.rs](./progress_bar.rs)<br />Renders a dynamic progress bar which fills up and then exits.|![preview](./images/progress_bar.png)|
20-
|[scrolling.rs](./scrolling.rs)<br />Demonstrates using the overflow property to implement scrollable text.|![preview](./images/scrolling.png)|
20+
|[scrolling.rs](./scrolling.rs)<br />Demonstrates using `ScrollView` to implement scrollable text.|![preview](./images/scrolling.png)|
2121
|[table.rs](./table.rs)<br />Displays a list of users provided by reference via properties.|![preview](./images/table.png)|
2222
|[use_input.rs](./use_input.rs)<br />Demonstrates using keyboard input to move a 👾.|![preview](./images/use_input.png)|
2323
|[use_output.rs](./use_output.rs)<br />Continuously logs text output above the rendered component.|![preview](./images/use_output.png)|

examples/images/scrolling.png

3.53 KB
Loading

examples/scrolling.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,21 @@ fn Example<'a>(props: &Props<'a>, mut hooks: Hooks) -> impl Into<AnyElement<'sta
3030

3131
system.set_mouse_capture(mouse_captured.get());
3232

33-
let mouse_status = if mouse_captured.get() { "on" } else { "off" };
34-
3533
element! {
3634
View(
3735
flex_direction: FlexDirection::Column,
3836
padding: 2,
3937
align_items: AlignItems::Center
4038
) {
41-
Text(content: format!(
42-
"Arrow keys/mouse wheel to scroll, 'm' to toggle mouse capture ({}), 'q' to exit",
43-
mouse_status
44-
))
39+
Text(content: if mouse_captured.get() {
40+
"Use arrow keys or mouse wheel to scroll.\nPress 'm' to disable mouse capture or 'q' to quit."
41+
} else {
42+
"Use arrow keys to scroll.\nPress 'm' to enable mouse capture or 'q' to quit."
43+
}, align: TextAlign::Center)
4544
View(
4645
border_style: BorderStyle::DoubleLeftRight,
4746
border_color: Color::Green,
48-
margin: 1,
47+
margin_top: 1,
4948
width: 78,
5049
height: 10,
5150
) {

0 commit comments

Comments
 (0)