diff options
author | 2023-06-27 23:16:54 +0200 | |
---|---|---|
committer | 2023-06-27 23:16:54 +0200 | |
commit | 9d83718fbef99479beaaaeec69f629bbb57dbb83 (patch) | |
tree | 7558290098aa0e4748c6ee94ffd66c74b0b5b54c /examples/scrollable/src | |
parent | 2d2ed4048ced21c3f0325213c047968e81abe300 (diff) | |
parent | 1c26440f0bd8f7a002946524dd4d522ba9fb7f29 (diff) | |
download | iced-9d83718fbef99479beaaaeec69f629bbb57dbb83.tar.gz iced-9d83718fbef99479beaaaeec69f629bbb57dbb83.tar.bz2 iced-9d83718fbef99479beaaaeec69f629bbb57dbb83.zip |
Merge pull request #1878 from AustinMReppert/master
Minor Scrollable Improvements
Diffstat (limited to 'examples/scrollable/src')
-rw-r--r-- | examples/scrollable/src/main.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs index 3038661e..4104871f 100644 --- a/examples/scrollable/src/main.rs +++ b/examples/scrollable/src/main.rs @@ -5,6 +5,7 @@ use iced::widget::{ }; use iced::{executor, theme, Alignment, Color}; use iced::{Application, Command, Element, Length, Settings, Theme}; + use once_cell::sync::Lazy; static SCROLLABLE_ID: Lazy<scrollable::Id> = Lazy::new(scrollable::Id::unique); @@ -199,12 +200,12 @@ impl Application for ScrollableDemo { .spacing(40), ) .height(Length::Fill) - .vertical_scroll( + .direction(scrollable::Direction::Vertical( Properties::new() .width(self.scrollbar_width) .margin(self.scrollbar_margin) .scroller_width(self.scroller_width), - ) + )) .id(SCROLLABLE_ID.clone()) .on_scroll(Message::Scrolled), Direction::Horizontal => scrollable( @@ -223,12 +224,12 @@ impl Application for ScrollableDemo { .spacing(40), ) .height(Length::Fill) - .horizontal_scroll( + .direction(scrollable::Direction::Horizontal( Properties::new() .width(self.scrollbar_width) .margin(self.scrollbar_margin) .scroller_width(self.scroller_width), - ) + )) .style(theme::Scrollable::custom(ScrollbarCustomStyle)) .id(SCROLLABLE_ID.clone()) .on_scroll(Message::Scrolled), @@ -264,18 +265,17 @@ impl Application for ScrollableDemo { .spacing(40), ) .height(Length::Fill) - .vertical_scroll( - Properties::new() - .width(self.scrollbar_width) - .margin(self.scrollbar_margin) - .scroller_width(self.scroller_width), - ) - .horizontal_scroll( - Properties::new() + .direction({ + let properties = Properties::new() .width(self.scrollbar_width) .margin(self.scrollbar_margin) - .scroller_width(self.scroller_width), - ) + .scroller_width(self.scroller_width); + + scrollable::Direction::Both { + horizontal: properties, + vertical: properties, + } + }) .style(theme::Scrollable::Custom(Box::new( ScrollbarCustomStyle, ))) |