diff options
| author | 2023-01-08 20:07:11 +0100 | |
|---|---|---|
| committer | 2023-01-08 20:07:11 +0100 | |
| commit | 624a4ada7981eb05c0b50cafa7e9545ad8347cb5 (patch) | |
| tree | 4ef01bfbe31333aff06d738ae51272a570c6f11b /examples | |
| parent | 9f85e0c721927f1e3bd195a998ec7a80ec0e7455 (diff) | |
| download | iced-624a4ada7981eb05c0b50cafa7e9545ad8347cb5.tar.gz iced-624a4ada7981eb05c0b50cafa7e9545ad8347cb5.tar.bz2 iced-624a4ada7981eb05c0b50cafa7e9545ad8347cb5.zip | |
Introduce `RelativeOffset` type in `scrollable`
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/scrollable/src/main.rs | 14 | ||||
| -rw-r--r-- | examples/websocket/src/main.rs | 4 | 
2 files changed, 9 insertions, 9 deletions
| diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs index 43c863cb..702ade35 100644 --- a/examples/scrollable/src/main.rs +++ b/examples/scrollable/src/main.rs @@ -3,7 +3,7 @@ use iced::widget::{      button, column, container, horizontal_space, progress_bar, radio, row,      scrollable, slider, text, vertical_space,  }; -use iced::{executor, theme, Alignment, Color, Point}; +use iced::{executor, theme, Alignment, Color};  use iced::{Application, Command, Element, Length, Settings, Theme};  use once_cell::sync::Lazy; @@ -18,7 +18,7 @@ struct ScrollableDemo {      scrollbar_width: u16,      scrollbar_margin: u16,      scroller_width: u16, -    current_scroll_offset: Point, +    current_scroll_offset: scrollable::RelativeOffset,  }  #[derive(Debug, Clone, Eq, PartialEq, Copy)] @@ -36,7 +36,7 @@ enum Message {      ScrollerWidthChanged(u16),      ScrollToBeginning,      ScrollToEnd, -    Scrolled(Point), +    Scrolled(scrollable::RelativeOffset),  }  impl Application for ScrollableDemo { @@ -52,7 +52,7 @@ impl Application for ScrollableDemo {                  scrollbar_width: 10,                  scrollbar_margin: 0,                  scroller_width: 10, -                current_scroll_offset: Point::ORIGIN, +                current_scroll_offset: scrollable::RelativeOffset::START,              },              Command::none(),          ) @@ -65,7 +65,7 @@ impl Application for ScrollableDemo {      fn update(&mut self, message: Message) -> Command<Message> {          match message {              Message::SwitchDirection(direction) => { -                self.current_scroll_offset = Point::ORIGIN; +                self.current_scroll_offset = scrollable::RelativeOffset::START;                  self.scrollable_direction = direction;                  scrollable::snap_to( @@ -89,7 +89,7 @@ impl Application for ScrollableDemo {                  Command::none()              }              Message::ScrollToBeginning => { -                self.current_scroll_offset = Point::ORIGIN; +                self.current_scroll_offset = scrollable::RelativeOffset::START;                  scrollable::snap_to(                      SCROLLABLE_ID.clone(), @@ -97,7 +97,7 @@ impl Application for ScrollableDemo {                  )              }              Message::ScrollToEnd => { -                self.current_scroll_offset = Point::new(1.0, 1.0); +                self.current_scroll_offset = scrollable::RelativeOffset::END;                  scrollable::snap_to(                      SCROLLABLE_ID.clone(), diff --git a/examples/websocket/src/main.rs b/examples/websocket/src/main.rs index d1e45571..ccd9c815 100644 --- a/examples/websocket/src/main.rs +++ b/examples/websocket/src/main.rs @@ -1,10 +1,10 @@  mod echo;  use iced::alignment::{self, Alignment}; +use iced::executor;  use iced::widget::{      button, column, container, row, scrollable, text, text_input, Column,  }; -use iced::{executor, Point};  use iced::{      Application, Color, Command, Element, Length, Settings, Subscription, Theme,  }; @@ -83,7 +83,7 @@ impl Application for WebSocket {                      scrollable::snap_to(                          MESSAGE_LOG.clone(), -                        Point::new(0.0, 1.0), +                        scrollable::RelativeOffset::END,                      )                  }              }, | 
