diff options
author | 2023-04-21 01:03:57 +0200 | |
---|---|---|
committer | 2023-04-21 01:03:57 +0200 | |
commit | 99fc717b7c268abe49b1000d9f111b12562aafcf (patch) | |
tree | 9c4f736ed7b1d36356976061ebc7fa93703723c8 | |
parent | 4052ccf2b52acda99c6186e3494a582579ce62bb (diff) | |
parent | a38bf092a88a2d59a11d7bc428c7c242840d7d6d (diff) | |
download | iced-99fc717b7c268abe49b1000d9f111b12562aafcf.tar.gz iced-99fc717b7c268abe49b1000d9f111b12562aafcf.tar.bz2 iced-99fc717b7c268abe49b1000d9f111b12562aafcf.zip |
Merge pull request #1804 from tarkah/fix/scroll-to-imports
Export scroll_to helper
Diffstat (limited to '')
-rw-r--r-- | native/src/widget/scrollable.rs | 9 | ||||
-rw-r--r-- | src/widget.rs | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs index c9ad5947..e35a4f96 100644 --- a/native/src/widget/scrollable.rs +++ b/native/src/widget/scrollable.rs @@ -392,6 +392,15 @@ pub fn snap_to<Message: 'static>( Command::widget(operation::scrollable::snap_to(id.0, offset)) } +/// Produces a [`Command`] that scrolls the [`Scrollable`] with the given [`Id`] +/// to the provided [`AbsoluteOffset`] along the x & y axis. +pub fn scroll_to<Message: 'static>( + id: Id, + offset: AbsoluteOffset, +) -> Command<Message> { + Command::widget(operation::scrollable::scroll_to(id.0, offset)) +} + /// Computes the layout of a [`Scrollable`]. pub fn layout<Renderer>( renderer: &Renderer, diff --git a/src/widget.rs b/src/widget.rs index 38995a45..1163904d 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -109,8 +109,8 @@ pub mod radio { pub mod scrollable { //! Navigate an endless amount of content with a scrollbar. pub use iced_native::widget::scrollable::{ - snap_to, style::Scrollbar, style::Scroller, AbsoluteOffset, Id, - Properties, RelativeOffset, StyleSheet, Viewport, + scroll_to, snap_to, style::Scrollbar, style::Scroller, AbsoluteOffset, + Id, Properties, RelativeOffset, StyleSheet, Viewport, }; /// A widget that can vertically display an infinite amount of content |