From b623f280ed43b04cef16a82de4cdf13497b5d63e Mon Sep 17 00:00:00 2001 From: Cory Forsstrom Date: Fri, 14 Apr 2023 13:32:44 -0700 Subject: Add `scroll_to` operation for absolute scroll --- examples/scrollable/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs index 2e99b1ac..be8d0f52 100644 --- a/examples/scrollable/src/main.rs +++ b/examples/scrollable/src/main.rs @@ -36,7 +36,7 @@ enum Message { ScrollerWidthChanged(u16), ScrollToBeginning, ScrollToEnd, - Scrolled(scrollable::RelativeOffset), + Scrolled(scrollable::CurrentOffset), } impl Application for ScrollableDemo { @@ -105,7 +105,7 @@ impl Application for ScrollableDemo { ) } Message::Scrolled(offset) => { - self.current_scroll_offset = offset; + self.current_scroll_offset = offset.relative; Command::none() } -- cgit From 6ad5e03d71db3dee174ac6512dceccc80e3a70a8 Mon Sep 17 00:00:00 2001 From: Cory Forsstrom Date: Mon, 17 Apr 2023 13:55:40 -0700 Subject: Add scrollable `Viewport` --- examples/scrollable/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs index be8d0f52..97344c94 100644 --- a/examples/scrollable/src/main.rs +++ b/examples/scrollable/src/main.rs @@ -36,7 +36,7 @@ enum Message { ScrollerWidthChanged(u16), ScrollToBeginning, ScrollToEnd, - Scrolled(scrollable::CurrentOffset), + Scrolled(scrollable::Viewport), } impl Application for ScrollableDemo { @@ -104,8 +104,8 @@ impl Application for ScrollableDemo { self.current_scroll_offset, ) } - Message::Scrolled(offset) => { - self.current_scroll_offset = offset.relative; + Message::Scrolled(viewport) => { + self.current_scroll_offset = viewport.relative_offset(); Command::none() } -- cgit