pub struct ScrollGeometry {
pub rect: Rect,
pub content: Size,
pub offset: Vec2,
pub max_offset: Vec2,
}Expand description
What the last layout resolved for a scroll container: where the container
landed, how big its content came out, and the offset it clamped. All
logical px, in the same viewport coordinates on_layout reports.
This is the geometry a view needs to build only the rows that can be seen
— it is read during the next frame’s build, so it describes the frame
before. See Core::scroll_geometry for what that costs and
widgets::uniform_list for the uniform-row case done for you.
The four numbers describe one moment, which is what makes arithmetic on
them safe: offset is always within max_offset, even immediately after
a set_scroll wrote something wilder (the documented “a huge value jumps
to the end” would otherwise hand a view an index a million rows past its
data).
Fields§
§rect: RectThe container’s own box, as the last layout placed and sized it —
the same rect an on_layout on that node would have reported.
content: SizeIts laid-out content, padding included. Bigger than rect on an axis
exactly when that axis has somewhere left to scroll.
offset: Vec2Where the container is scrolled to (positive = content moved up /
left): the retained offset clamped to max_offset, which is what the
next layout will resolve it to unless the content changes size in the
same frame. Core::scroll_offset is the unclamped retained number.
max_offset: Vec2How far offset can travel on each axis — zero on an axis that does
not scroll, or whose content fits. offset == max_offset is “at the
end”, which is how a log view asks whether it is still tailing.
Implementations§
Trait Implementations§
Source§impl Clone for ScrollGeometry
impl Clone for ScrollGeometry
Source§fn clone(&self) -> ScrollGeometry
fn clone(&self) -> ScrollGeometry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ScrollGeometry
Source§impl Debug for ScrollGeometry
impl Debug for ScrollGeometry
Source§impl PartialEq for ScrollGeometry
impl PartialEq for ScrollGeometry
impl StructuralPartialEq for ScrollGeometry
Auto Trait Implementations§
impl Freeze for ScrollGeometry
impl RefUnwindSafe for ScrollGeometry
impl Send for ScrollGeometry
impl Sync for ScrollGeometry
impl Unpin for ScrollGeometry
impl UnsafeUnpin for ScrollGeometry
impl UnwindSafe for ScrollGeometry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.