pub struct Viewport {
pub x: Offset,
pub y: Offset,
pub bounds: Rectangle,
pub content: Size,
}Expand description
The current Viewport of the Scrollable.
Fields§
§x: OffsetThe current X offset, in Offset units.
y: OffsetThe current Y offset, in Offset units.
bounds: RectangleThe bounds of the Scrollable.
content: SizeThe size of the content of the Scrollable.
Implementations§
Source§impl Viewport
impl Viewport
Sourcepub fn end(&self) -> AbsoluteOffset
pub fn end(&self) -> AbsoluteOffset
Returns the end of the Viewport.
Sourcepub fn slide(self, other: Viewport) -> Viewport
pub fn slide(self, other: Viewport) -> Viewport
Returns a new Viewport aligned with the coordinates of the
given one.
Sourcepub fn distance_to_end(&self) -> Vector
pub fn distance_to_end(&self) -> Vector
Returns the distance from the current scroll position to the end of the content, in pixels, per axis.
This is the amount of content that can still be scrolled into view: it is zero when the content fits, or when the scroll is at the end.
Sourcepub fn absolute_offset(&self) -> AbsoluteOffset
pub fn absolute_offset(&self) -> AbsoluteOffset
Returns the AbsoluteOffset of the current Viewport.
Sourcepub fn absolute_offset_reversed(&self) -> AbsoluteOffset
pub fn absolute_offset_reversed(&self) -> AbsoluteOffset
Returns the AbsoluteOffset of the current Viewport, but with its
alignment reversed.
This method can be useful to switch the alignment of a Scrollable
while maintaining its scrolling position.
Sourcepub fn relative_offset(&self) -> RelativeOffset
pub fn relative_offset(&self) -> RelativeOffset
Returns the RelativeOffset of the current Viewport.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Viewport
impl RefUnwindSafe for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin for Viewport
impl UnsafeUnpin for Viewport
impl UnwindSafe for Viewport
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.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