pub struct ScrollIntoViewRequest {
pub container: Option<WidgetId>,
pub target: WidgetId,
pub axis: ScrollAxis,
pub alignment: ScrollAlignment,
pub padding: [f32; 4],
pub behavior: ScrollBehavior,
pub if_needed: bool,
}Expand description
Request a post-layout scroll adjustment that reveals a target widget.
Reducers can emit this as a runtime effect when application state changes. The runtime resolves it after the next layout pass, when target and container rectangles are available, then mutates the scroll state and schedules another frame so paint, hit testing, and semantics see the new offset.
§Example
ⓘ
ctx.effects.scroll_into_view(ScrollIntoViewRequest {
container: Some(WidgetId::explicit("document.canvas.scroll")),
target: WidgetId::explicit("document.page.3"),
axis: ScrollAxis::Vertical,
alignment: ScrollAlignment::Start,
padding: [24.0, 24.0, 24.0, 24.0],
behavior: ScrollBehavior::Instant,
if_needed: false,
});Fields§
§container: Option<WidgetId>Explicit scroll container, or None to use the nearest matching scroll ancestor.
target: WidgetIdDescendant widget that should become visible.
axis: ScrollAxisAxis to scroll.
alignment: ScrollAlignmentAlignment to use when computing the new offset.
padding: [f32; 4]Reveal margin as [left, right, top, bottom].
behavior: ScrollBehaviorWhether to jump immediately or request smooth behavior.
if_needed: boolIf true, leave the offset unchanged when the target is already fully visible.
Trait Implementations§
Source§impl Clone for ScrollIntoViewRequest
impl Clone for ScrollIntoViewRequest
Source§fn clone(&self) -> ScrollIntoViewRequest
fn clone(&self) -> ScrollIntoViewRequest
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 moreSource§impl Debug for ScrollIntoViewRequest
impl Debug for ScrollIntoViewRequest
Source§impl<'de> Deserialize<'de> for ScrollIntoViewRequest
impl<'de> Deserialize<'de> for ScrollIntoViewRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ScrollIntoViewRequest
impl PartialEq for ScrollIntoViewRequest
Source§impl Serialize for ScrollIntoViewRequest
impl Serialize for ScrollIntoViewRequest
impl StructuralPartialEq for ScrollIntoViewRequest
Auto Trait Implementations§
impl Freeze for ScrollIntoViewRequest
impl RefUnwindSafe for ScrollIntoViewRequest
impl Send for ScrollIntoViewRequest
impl Sync for ScrollIntoViewRequest
impl Unpin for ScrollIntoViewRequest
impl UnsafeUnpin for ScrollIntoViewRequest
impl UnwindSafe for ScrollIntoViewRequest
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.