pub struct ScrollState {
pub offset_x: u16,
pub offset_y: u16,
pub content_width: u16,
pub content_height: u16,
pub viewport_width: u16,
pub viewport_height: u16,
}Expand description
Scroll state for a single widget.
Fields§
§offset_x: u16Horizontal scroll offset in cells.
offset_y: u16Vertical scroll offset in cells.
content_width: u16Total content width in cells.
content_height: u16Total content height in cells.
viewport_width: u16Viewport width in cells.
viewport_height: u16Viewport height in cells.
Implementations§
Source§impl ScrollState
impl ScrollState
Sourcepub const fn new(
content_width: u16,
content_height: u16,
viewport_width: u16,
viewport_height: u16,
) -> Self
pub const fn new( content_width: u16, content_height: u16, viewport_width: u16, viewport_height: u16, ) -> Self
Create a new scroll state.
Sourcepub const fn can_scroll_x(&self) -> bool
pub const fn can_scroll_x(&self) -> bool
Whether horizontal scrolling is possible.
Sourcepub const fn can_scroll_y(&self) -> bool
pub const fn can_scroll_y(&self) -> bool
Whether vertical scrolling is possible.
Sourcepub fn max_offset_x(&self) -> u16
pub fn max_offset_x(&self) -> u16
Maximum horizontal scroll offset.
Sourcepub fn max_offset_y(&self) -> u16
pub fn max_offset_y(&self) -> u16
Maximum vertical scroll offset.
Sourcepub fn visible_rect(&self) -> Rect
pub fn visible_rect(&self) -> Rect
The visible content rectangle (in content coordinates).
Trait Implementations§
Source§impl Clone for ScrollState
impl Clone for ScrollState
Source§fn clone(&self) -> ScrollState
fn clone(&self) -> ScrollState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScrollState
impl Debug for ScrollState
Source§impl Default for ScrollState
impl Default for ScrollState
Source§fn default() -> ScrollState
fn default() -> ScrollState
Returns the “default value” for a type. Read more
Source§impl PartialEq for ScrollState
impl PartialEq for ScrollState
impl StructuralPartialEq for ScrollState
Auto Trait Implementations§
impl Freeze for ScrollState
impl RefUnwindSafe for ScrollState
impl Send for ScrollState
impl Sync for ScrollState
impl Unpin for ScrollState
impl UnwindSafe for ScrollState
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
Mutably borrows from an owned value. Read more