Skip to main content

InstantScrollPhysics

Struct InstantScrollPhysics 

Source
pub struct InstantScrollPhysics;
Expand description

Zero-size, zero-allocation default ScrollPhysicsEngine: immediate clamped scroll offsets honoring Scroll::axes and OverscrollBehavior::{Auto, Contain, None} with zero animations and zero memory overhead (size_of::<InstantScrollPhysics>() == 0).

Trait Implementations§

Source§

impl Clone for InstantScrollPhysics

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for InstantScrollPhysics

Source§

impl Debug for InstantScrollPhysics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InstantScrollPhysics

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for InstantScrollPhysics

Source§

impl PartialEq for InstantScrollPhysics

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl ScrollPhysicsEngine for InstantScrollPhysics

Source§

fn on_scroll_delta( &mut self, ctx: &ScrollContainerCtx<'_>, dx: f32, dy: f32, _kind: ScrollInputKind, out: &mut ScrollDeltaResult, )

Consumes (dx, dy) on one scroll container along the ancestor chain. Read more
Source§

fn on_gesture_start( &mut self, _store: &NodeStore, _bounds: &dyn ScrollBoundsLookup, _start: NodeId, _now_ms: ScrollTimestampMs, )

Called on ScrollTouchPhase::Started to latch start, catch in-flight animations on its ancestor chain (stopping at top-layer overlay boundaries), and finalize abandoned drags on other containers.
Source§

fn latched_target(&self) -> Option<NodeId>

Returns the currently latched gesture target node, if any.
Source§

fn on_gesture_move(&mut self, _now_ms: ScrollTimestampMs)

Updates monotonic gesture timestamp on ScrollTouchPhase::Moved.
Source§

fn on_outermost_overscroll( &mut self, _ctx: &ScrollContainerCtx<'_>, _axis: ScrollAxis, _rem: f32, _kind: ScrollInputKind, ) -> bool

Feeds leftover unconsumed OverscrollBehavior::Auto delta into the outermost eligible container on axis. Returns true if visual overscroll changed.
Source§

fn on_gesture_end( &mut self, _store: &NodeStore, _scroll: &mut ScrollOffsets, _now_ms: ScrollTimestampMs, _cancelled: bool, _out_visual: &mut Vec<NodeId>, _out_clamped: &mut Vec<NodeId>, )

Called when a phased trackpad/touch gesture ends or is cancelled, transitioning active drags into fling momentum, snap animations, or boundary return springs. Any immediate clamped offset changes must push affected node IDs into both out_visual and out_clamped.
Source§

fn step( &mut self, _store: &NodeStore, _bounds: &dyn ScrollBoundsLookup, _scroll: &mut ScrollOffsets, _dt_s: f32, _out_visual: &mut Vec<NodeId>, _out_clamped: &mut Vec<NodeId>, ) -> bool

Advances all active scroll animations by dt_s seconds, writing clamped offset updates into scroll and pushing affected container IDs into out_visual / out_clamped with zero steady-state heap allocations. Returns true while any animation remains active.
Source§

fn overscroll(&self, _node: NodeId) -> (f32, f32)

Active visual overscroll (ox, oy) for node ((0.0, 0.0) when idle).
Source§

fn has_active(&self) -> bool

Whether any container currently has an active animation requiring vsync frames.
Source§

fn px_per_line(&self) -> f32

Logical pixels per discrete mouse-wheel line detent.
Source§

fn cancel_node(&mut self, _node: NodeId)

Cancels any active animation, drag, or overscroll state for node.
Source§

fn reconcile_node( &mut self, node: NodeId, _new_pos: (f32, f32), _max: (f32, f32), _anchor_delta: (f32, f32), explicit_seek: bool, )

Reconciles active physics bounds/offsets across layout commits without killing active momentum unless explicit_seek is true.
Source§

fn prune_missing(&mut self, _store: &NodeStore)

Prunes state for nodes that are no longer live Scroll containers in store.
Source§

fn clear(&mut self)

Clears all internal physics and gesture state (called on crate::LaidOutScene::reset).
Source§

fn set_reduced_motion( &mut self, _reduced: bool, _scroll: &mut ScrollOffsets, _out_visual: &mut Vec<NodeId>, _out_clamped: &mut Vec<NodeId>, ) -> bool

Updates reduced-motion mode. When reduced is true, engines snap active smooth-wheel animations to their targets, updating scroll and pushing snapped nodes into out_visual/out_clamped. Returns true if any node snapped.
Source§

fn set_synthetic_momentum(&mut self, _enabled: bool)

Controls whether phased trackpad/touch releases spawn synthetic momentum (false on macOS by default because AppKit delivers native OS momentum via PixelDelta).
Source§

impl StructuralPartialEq for InstantScrollPhysics

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.