Implement text clipping (caching still broken)

This commit is contained in:
Héctor Ramón Jiménez 2019-10-28 04:28:21 +01:00
parent 35e94f5a32
commit 2b23e0986c
5 changed files with 18 additions and 29 deletions

View file

@ -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")