This module implements an inertial scroll detector to provide an event-driven mechanism to know when inertial scrolling occurs.
This is the directed state diagram for the inertial scroll detector.
Initialize a ScrollState from current
scroll offset left and top values.
import Curtissimo.IntertialScrollDetector as Detector
type alias Model =
{ scrollState : Detector.ScrollState }
init =
( scrollState = Detector.init 0 0
, Cmd.none
)Update the detector from the events occurring in the window.
See onInertialScroll for the events the detector uses to monitor for inertial scrolling.
import Curtissimo.IntertialScrollDetector as Detector
update msg model =
case msg of
InertialScroll scrollMsg ->
( { model
| scrollState = Detector.update scrollMsg
}
, Cmd.none
)The direction of the inertial scroll.
Get the current inertial scroll in the X (horizontal) direction.
Get the current inertial scroll in the Y (vertical) direction.
Get the current left scroll position from the latest inertial scroll.
Get the current top scroll position from the latest inertial scroll.
The messages used to monitor the scrollable area.
The state maintained by the detector.
Adds the following passive event listeners to the scrollable area.
scrollto monitor for scroll events after touch-endscrollendto monitor for when inertial scrolling endstouchstartto activate that detectortouchmoveto transition the detector to an eligible state for inertial scrollingtouchendto transition the detector to a montoring state for inertial scrolling