From 2b23e0986c532dbacd89ccd73bb603db558cbdaf Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 28 Oct 2019 04:28:21 +0100 Subject: Implement text clipping (caching still broken) --- examples/scroll.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'examples') 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 { - //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") -- cgit