pub struct State { /* private fields */ }
Expand description
The local state of a Scrollable
.
Implementations
sourceimpl State
impl State
sourcepub fn scroll(
&mut self,
delta_y: f32,
bounds: Rectangle<f32>,
content_bounds: Rectangle<f32>
)
pub fn scroll(
&mut self,
delta_y: f32,
bounds: Rectangle<f32>,
content_bounds: Rectangle<f32>
)
Apply a scrolling offset to the current State
, given the bounds of
the Scrollable
and its contents.
sourcepub fn scroll_to(
&mut self,
percentage: f32,
bounds: Rectangle<f32>,
content_bounds: Rectangle<f32>
)
pub fn scroll_to(
&mut self,
percentage: f32,
bounds: Rectangle<f32>,
content_bounds: Rectangle<f32>
)
Scrolls the Scrollable
to a relative amount.
0
represents scrollbar at the top, while 1
represents scrollbar at
the bottom.
sourcepub fn snap_to(&mut self, percentage: f32)
pub fn snap_to(&mut self, percentage: f32)
Snaps the scroll position to a relative amount.
0
represents scrollbar at the top, while 1
represents scrollbar at
the bottom.
sourcepub fn unsnap(&mut self, bounds: Rectangle<f32>, content_bounds: Rectangle<f32>)
pub fn unsnap(&mut self, bounds: Rectangle<f32>, content_bounds: Rectangle<f32>)
Unsnaps the current scroll position, if snapped, given the bounds of the
Scrollable
and its contents.
sourcepub fn offset(
&self,
bounds: Rectangle<f32>,
content_bounds: Rectangle<f32>
) -> u32
pub fn offset(
&self,
bounds: Rectangle<f32>,
content_bounds: Rectangle<f32>
) -> u32
Returns the current scrolling offset of the State
, given the bounds
of the Scrollable
and its contents.
sourcepub fn is_scroller_grabbed(&self) -> bool
pub fn is_scroller_grabbed(&self) -> bool
Returns whether the scroller is currently grabbed or not.
sourcepub fn is_scroll_box_touched(&self) -> bool
pub fn is_scroll_box_touched(&self) -> bool
Returns whether the scroll box is currently touched or not.
Trait Implementations
impl Copy for State
Auto Trait Implementations
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnwindSafe for State
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more