pub enum ScrollRequest {
ToRow {
list_key: String,
row: usize,
align: ScrollAlignment,
},
EnsureVisible {
container_key: String,
y: f32,
h: f32,
},
}Expand description
What the app produces from crate::App::drain_scroll_requests.
Two shapes today:
ScrollRequest::ToRow— “scroll the virtual list keyedlist_keyso rowrowlands peralign.” Resolved during layout of the matchingvirtual_list/virtual_list_dynusing the live viewport and the row-height cache.ScrollRequest::EnsureVisible— “scroll the nearest scroll container under the node keyedcontainer_keyso the content- space recty..y+his visible.” Resolved during layout of the matchingscroll(...)container; minimal-displacement (top edge if above viewport, bottom edge if below, no-op if already visible). Used bycrate::widgets::text_areafor caret-into-view on keyboard navigation, and available for any widget that needs to keep an inner anchor on screen.
Variants§
ToRow
Bring row of the virtual list keyed list_key into view per
align.
EnsureVisible
Ensure the content-space rect at y..y+h is visible inside
the scroll container under the node keyed container_key.
container_key is the outer widget’s key (e.g. the text_area’s
key) — the resolver descends to find the nearest Kind::Scroll
inside that node.
Implementations§
Source§impl ScrollRequest
impl ScrollRequest
Sourcepub fn new(
list_key: impl Into<String>,
row: usize,
align: ScrollAlignment,
) -> Self
pub fn new( list_key: impl Into<String>, row: usize, align: ScrollAlignment, ) -> Self
Construct a ScrollRequest::ToRow. Kept for source-compat
with callers that predate the enum — ScrollRequest::new(...)
has always meant “scroll a virtual list to a row.”
Sourcepub fn ensure_visible(container_key: impl Into<String>, y: f32, h: f32) -> Self
pub fn ensure_visible(container_key: impl Into<String>, y: f32, h: f32) -> Self
Construct a ScrollRequest::EnsureVisible for the widget
keyed container_key, asking the resolver to keep
y..y+h (in the scroll container’s content coordinates)
inside the viewport.
Trait Implementations§
Source§impl Clone for ScrollRequest
impl Clone for ScrollRequest
Source§fn clone(&self) -> ScrollRequest
fn clone(&self) -> ScrollRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ScrollRequest
impl RefUnwindSafe for ScrollRequest
impl Send for ScrollRequest
impl Sync for ScrollRequest
impl Unpin for ScrollRequest
impl UnsafeUnpin for ScrollRequest
impl UnwindSafe for ScrollRequest
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.