pub enum ScrollRequest {
ToRow {
list_key: String,
row: usize,
align: ScrollAlignment,
},
ToRowKey {
list_key: String,
row_key: String,
align: ScrollAlignment,
},
EnsureVisible {
container_key: String,
y: f32,
h: f32,
},
}Expand description
What the app produces from crate::App::drain_scroll_requests.
Three 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::ToRowKey— same operation, but targets the virtual-list row by stable row identity instead of current row index. Prefer this forvirtual_list_dynwhen the app already has message/thread/commit ids.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.
ToRowKey
Bring the row identified by row_key in 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 to_row_key(
list_key: impl Into<String>,
row_key: impl Into<String>,
align: ScrollAlignment,
) -> Self
pub fn to_row_key( list_key: impl Into<String>, row_key: impl Into<String>, align: ScrollAlignment, ) -> Self
Construct a ScrollRequest::ToRowKey. Dynamic virtual lists
resolve this against the same stable row identities passed to
crate::virtual_list_dyn.
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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.