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
impl Clone for InstantScrollPhysics
impl Copy for InstantScrollPhysics
Source§impl Debug for InstantScrollPhysics
impl Debug for InstantScrollPhysics
Source§impl Default for InstantScrollPhysics
impl Default for InstantScrollPhysics
impl Eq for InstantScrollPhysics
Source§impl PartialEq for InstantScrollPhysics
impl PartialEq for InstantScrollPhysics
Source§impl ScrollPhysicsEngine for InstantScrollPhysics
impl ScrollPhysicsEngine for InstantScrollPhysics
Source§fn on_scroll_delta(
&mut self,
ctx: &ScrollContainerCtx<'_>,
dx: f32,
dy: f32,
_kind: ScrollInputKind,
out: &mut ScrollDeltaResult,
)
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 moreSource§fn on_gesture_start(
&mut self,
_store: &NodeStore,
_bounds: &dyn ScrollBoundsLookup,
_start: NodeId,
_now_ms: ScrollTimestampMs,
)
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>
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)
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
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>,
)
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
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)
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
fn has_active(&self) -> bool
Whether any container currently has an active animation requiring vsync frames.
Source§fn px_per_line(&self) -> f32
fn px_per_line(&self) -> f32
Logical pixels per discrete mouse-wheel line detent.
Source§fn cancel_node(&mut self, _node: NodeId)
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,
)
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)
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)
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
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)
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).impl StructuralPartialEq for InstantScrollPhysics
Auto Trait Implementations§
impl Forget for InstantScrollPhysics
impl Freeze for InstantScrollPhysics
impl Move for InstantScrollPhysics
impl RefUnwindSafe for InstantScrollPhysics
impl Send for InstantScrollPhysics
impl Sync for InstantScrollPhysics
impl Unpin for InstantScrollPhysics
impl UnsafeUnpin for InstantScrollPhysics
impl UnwindSafe for InstantScrollPhysics
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