summaryrefslogtreecommitdiffstats
path: root/examples/scroll.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-28 04:28:21 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-28 04:28:21 +0100
commit2b23e0986c532dbacd89ccd73bb603db558cbdaf (patch)
tree4c1e154fcc8be04c9d45eb68d1fce0ef23267add /examples/scroll.rs
parent35e94f5a324f5c28de855b725039733efb21b26a (diff)
downloadiced-2b23e0986c532dbacd89ccd73bb603db558cbdaf.tar.gz
iced-2b23e0986c532dbacd89ccd73bb603db558cbdaf.tar.bz2
iced-2b23e0986c532dbacd89ccd73bb603db558cbdaf.zip
Implement text clipping (caching still broken)
Diffstat (limited to 'examples/scroll.rs')
-rw-r--r--examples/scroll.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/examples/scroll.rs b/examples/scroll.rs
index b1e427bf..608923fe 100644
--- a/examples/scroll.rs
+++ b/examples/scroll.rs
@@ -4,6 +4,8 @@ use iced::{
};
pub fn main() {
+ env_logger::init();
+
Example::default().run()
}
@@ -32,25 +34,17 @@ impl Application for Example {
}
fn view(&mut self) -> Element<Message> {
- //let content = (0..3).fold(
- // Scrollable::new(&mut self.scroll).spacing(20).padding(20),
- // |content, _| {
- // content.push(
- // )
- // },
- //);
-
let content = (0..self.item_count)
.fold(
Scrollable::new(&mut self.scroll)
.spacing(20)
.padding(20)
.align_items(Align::Center),
- |column, i| {
+ |scrollable, i| {
if i % 2 == 0 {
- column.push(lorem_ipsum().width(Length::Units(600)))
+ scrollable.push(lorem_ipsum().width(Length::Units(600)))
} else {
- column.push(
+ scrollable.push(
Image::new(format!(
"{}/examples/resources/ferris.png",
env!("CARGO_MANIFEST_DIR")