Skip to main content

AutoScroll

Function AutoScroll 

Source
pub fn AutoScroll(_: AutoScrollProps) -> Element
Expand description

A scrollable container that scrolls itself while a drag hovers near its edges. Give it the overflow CSS yourself (via style/class) - and consider overscroll-behavior: contain alongside it, so a wheel or touch scroll that hits the container’s end mid-drag doesn’t chain into scrolling the page. (The edge-scrolling itself is programmatic, clamps at the container’s bounds, and never chains.)

§Props

For details, see the props struct definition.

  • threshold : f64

    Edge band size in px.

  • speed : f64

    Legacy maximum movement per nominal 60 Hz frame. Kept for 3.x source and behavior compatibility; new code should prefer speed_px_per_second.

  • speed_px_per_second : Option<f64>

    Exact maximum scroll velocity in CSS pixels per second. When set, this takes precedence over the legacy speed prop.

  • axis : ScrollAxis

    Axes to scroll.

  • active : Option<bool>

    Optional external drag-state gate. Some(true) scrolls on pointer movement, Some(false) suppresses it, and None uses the built-in pointer contact heuristic.

  • drag_pointer : Option<Point>

    Optional pointer supplied by a host that tracks movement outside this element’s DOM event stream, expressed in this window’s client coordinates. The sample is used only with active: Some(true); pass the matching drag’s live active state so a retained coordinate cannot scroll idle or settling content.

  • on_scroll : Option<EventHandler<Point>>

    Fired with the container’s scroll offset when a sample sees it changed - after the auto-scroll’s own scrolling, a wheel/trackpad scroll, or pointer movement over the container - following the rect-refresh ping. Drive a windowed (virtualized) list from offset.y. See the module docs for how observation works and its one blind spot.

  • attributes : Vec<Attribute>
  • children : Element