pub struct AutoScroll {
pub scroll_offset: f32,
pub enabled: bool,
pub distance_from_min: f32,
pub distance_from_max: f32,
pub max_speed: f32,
}Expand description
Handles automatic scrolling when dragging items near the edges of the table’s view.
The AutoScroll struct allows the table to automatically scroll when the user drags items
near the top or bottom edge of the view. It provides configurable parameters such as
the speed of scrolling and the distances from the edges at which scrolling is triggered.
Fields§
§scroll_offset: f32The current vertical scroll offset.
enabled: boolWhether auto-scrolling is enabled or disabled.
distance_from_min: f32The minimum distance from the top edge before auto-scrolling starts. Extra space due to the header being in the way. Default: 200.0
distance_from_max: f32The minimum distance from the bottom edge before auto-scrolling starts. Default: 120.0
max_speed: f32The maximum speed at which auto-scrolling occurs. Default: 30.0
Implementations§
Source§impl AutoScroll
impl AutoScroll
Sourcepub const fn distance_from_min(self, distance: f32) -> Self
pub const fn distance_from_min(self, distance: f32) -> Self
Sets the minimum distance from the top edge at which auto-scrolling is triggered.
§Parameters:
distance: The distance from the top edge in pixels.
§Returns:
An updated instance of AutoScroll with the specified distance_from_min value.
§Considerations:
- Add some extra distance due to the header being in the way of selection
§Example:
let auto_scroll = AutoScroll::new(true).distance_from_min(100.0); // Auto-scrolls when 100 pixels from topSourcepub const fn distance_from_max(self, distance: f32) -> Self
pub const fn distance_from_max(self, distance: f32) -> Self
Sets the minimum distance from the bottom edge at which auto-scrolling is triggered.
§Parameters:
distance: The distance from the bottom edge in pixels.
§Returns:
An updated instance of AutoScroll with the specified distance_from_max value.
§Example:
let auto_scroll = AutoScroll::new(true).distance_from_max(80.0); // Auto-scrolls when 80 pixels from bottomTrait Implementations§
Auto Trait Implementations§
impl Freeze for AutoScroll
impl RefUnwindSafe for AutoScroll
impl Send for AutoScroll
impl Sync for AutoScroll
impl Unpin for AutoScroll
impl UnwindSafe for AutoScroll
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more