Merge pull request #1804 from tarkah/fix/scroll-to-imports

Export scroll_to helper
This commit is contained in:
Héctor Ramón 2023-04-21 01:03:57 +02:00 committed by GitHub
commit 99fc717b7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -392,6 +392,15 @@ pub fn snap_to<Message: 'static>(
Command::widget(operation::scrollable::snap_to(id.0, offset)) 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`]. /// Computes the layout of a [`Scrollable`].
pub fn layout<Renderer>( pub fn layout<Renderer>(
renderer: &Renderer, renderer: &Renderer,

View file

@ -109,8 +109,8 @@ pub mod radio {
pub mod scrollable { pub mod scrollable {
//! Navigate an endless amount of content with a scrollbar. //! Navigate an endless amount of content with a scrollbar.
pub use iced_native::widget::scrollable::{ pub use iced_native::widget::scrollable::{
snap_to, style::Scrollbar, style::Scroller, AbsoluteOffset, Id, scroll_to, snap_to, style::Scrollbar, style::Scroller, AbsoluteOffset,
Properties, RelativeOffset, StyleSheet, Viewport, Id, Properties, RelativeOffset, StyleSheet, Viewport,
}; };
/// A widget that can vertically display an infinite amount of content /// A widget that can vertically display an infinite amount of content