Skip to main content

ScrollBehavior

Struct ScrollBehavior 

Source
pub struct ScrollBehavior {
Show 20 fields pub paging: bool, pub snap_interval: Points, pub snap_offsets: Vec<Points>, pub snap_alignment: SnapAlignment, pub deceleration: f32, pub enabled: bool, pub bounces: bool, pub scrolls_to_top: bool, pub smooth_wheel: bool, pub wheel_line_height: Points, pub content_inset: EdgeInsets, pub scrollbar_inset: EdgeInsets, pub keyboard_taps: KeyboardTaps, pub one_step: bool, pub min_zoom: f32, pub max_zoom: f32, pub bounces_zoom: bool, pub pinch: bool, pub center_content: bool, pub refresh_indicator: Option<Points>,
}
Expand description

How a scroll view scrolls (React Native’s ScrollView props).

Fields§

§paging: bool

Stops at multiples of the viewport.

§snap_interval: Points

Stops at multiples of this length (0: off).

§snap_offsets: Vec<Points>

Stops at these offsets.

§snap_alignment: SnapAlignment

Which point of a snap page aligns with the viewport.

§deceleration: f32

Velocity kept per millisecond after a fling (0: platform default).

§enabled: bool

The user can scroll it.

§bounces: bool

It overscrolls past its edges.

§scrolls_to_top: bool

A tap at the top of the window scrolls it to its top (iOS: UIScrollView.scrollsToTop).

§smooth_wheel: bool

A mouse wheel’s notches glide (smoothWheel).

§wheel_line_height: Points

Points a mouse wheel’s line scrolls; 0 for the platform’s own (wheelLineHeight).

§content_inset: EdgeInsets

Room around the content.

§scrollbar_inset: EdgeInsets

How far the scroll indicator keeps from each edge of the view: its track runs between the top and bottom insets (a horizontal view’s: left and right), and it moves in from the right (bottom) edge by the right (bottom) one. Platforms add the room they keep for the keyboard to the bottom.

§keyboard_taps: KeyboardTaps

Whether taps dismiss the keyboard.

§one_step: bool

A fling moves one snap point at most (disableIntervalMomentum).

§min_zoom: f32

minimumZoomScale.

§max_zoom: f32

maximumZoomScale: pinching zooms the content when above min_zoom (<scroll> only, not lists).

§bounces_zoom: bool

bouncesZoom: pinching may go past the limits and springs back.

§pinch: bool

zoomable: the user can pinch to zoom.

§center_content: bool

centerContent: content smaller than the viewport is centered.

§refresh_indicator: Option<Points>

refreshIndicator: the height of the app’s own pull-to-refresh indicator, which replaces the platform’s spinner; None for the platform’s.

Implementations§

Source§

impl ScrollBehavior

Source

pub fn zooms(&self) -> bool

Whether the content zooms (scrolling both ways while zoomed in).

Source

pub fn refreshes(&self, offset: Points) -> bool

Whether a vertical scroll view dragged to offset (negative: pulled past its top) refreshes when the finger lifts, if it listens to onRefresh and is not refreshing yet.

Source

pub fn refresh_threshold(&self) -> Points

How far past the top a released pull refreshes: the app’s indicator’s height, or the platform spinner’s distance.

Source

pub fn refresh_inset(&self) -> Points

The room kept above the content while it refreshes: the app’s indicator’s height, or the platform spinner’s.

Source

pub fn snaps(&self) -> bool

Whether flings end at snap points.

Source

pub fn snap_target( &self, offset: Points, projected: Points, velocity: f32, viewport: Points, content: Points, ) -> Option<Points>

The snap point a fling ends at, as in React Native: offset is where the drag ended, projected where the fling would glide to (both along the main axis, points) and velocity its speed (points per millisecond), for a viewport of viewport and content of content points. Pages (and one_step) move one snap point; other snapping rounds the projected offset in the fling’s direction. None without snapping.

Trait Implementations§

Source§

impl Clone for ScrollBehavior

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScrollBehavior

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ScrollBehavior

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ScrollBehavior

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ScrollBehavior

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.