pub trait ScrollActivityDelegate: Sized + 'static {
// Required methods
fn axis_direction(self: Handle<Self>, app: &App) -> AxisDirection;
fn set_pixels(self: Handle<Self>, app: &mut App, pixels: f64) -> f64;
fn apply_user_offset(self: Handle<Self>, app: &mut App, delta: f64);
fn go_idle(self: Handle<Self>, app: &mut App);
fn go_ballistic(self: Handle<Self>, app: &mut App, velocity: f64);
// Provided method
fn as_scroll_activity_delegate(
self: Handle<Self>,
) -> AnyScrollActivityDelegate { ... }
}Expand description
A backend for a ScrollActivity.
Used by implementors of ScrollActivity to manipulate the scroll view that
they are acting upon.
See also:
ScrollActivity, which uses this trait as its delegate.ScrollPositionWithSingleContext, the main implementation of this interface.
Required Methods§
Sourcefn axis_direction(self: Handle<Self>, app: &App) -> AxisDirection
fn axis_direction(self: Handle<Self>, app: &App) -> AxisDirection
The direction in which the scroll view scrolls.
Sourcefn set_pixels(self: Handle<Self>, app: &mut App, pixels: f64) -> f64
fn set_pixels(self: Handle<Self>, app: &mut App, pixels: f64) -> f64
Update the scroll position to the given pixel value.
Returns the overscroll, if any. See ScrollPosition::set_pixels for more
information.
Sourcefn apply_user_offset(self: Handle<Self>, app: &mut App, delta: f64)
fn apply_user_offset(self: Handle<Self>, app: &mut App, delta: f64)
Updates the scroll position by the given amount.
Appropriate for when the user is directly manipulating the scroll
position, for example by dragging the scroll view. Typically applies
crate::ScrollPhysics::apply_physics_to_user_offset and other transformations that
are appropriate for user-driving scrolling.
Sourcefn go_idle(self: Handle<Self>, app: &mut App)
fn go_idle(self: Handle<Self>, app: &mut App)
Terminate the current activity and start an idle activity.
Sourcefn go_ballistic(self: Handle<Self>, app: &mut App, velocity: f64)
fn go_ballistic(self: Handle<Self>, app: &mut App, velocity: f64)
Terminate the current activity and start a ballistic activity with the given velocity.
Provided Methods§
Sourcefn as_scroll_activity_delegate(self: Handle<Self>) -> AnyScrollActivityDelegate
fn as_scroll_activity_delegate(self: Handle<Self>) -> AnyScrollActivityDelegate
This delegate as the erased AnyScrollActivityDelegate — what to pass where a Dart
API takes a ScrollActivityDelegate.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".