A low- and high-level interface to mouse drag actions in Elm. For documentation of the latest published version, see also http://package.elm-lang.org/packages/jvoigtlaender/elm-drag/latest/Drag.
For reporting any issues, see https://github.com/jvoigtlaender/elm-drag/issues.
The low-level interface is:
type MouseEvent = StartAt ( Int, Int ) | MoveFromTo ( Int, Int ) ( Int, Int ) | EndAt ( Int, Int ) mouseEvents : Signal MouseEvent
The recommended, high-level interface consists of the
type Action = Lift | MoveBy ( Int, Int ) | Release track : Bool -> Signal Bool -> Signal (Maybe Action) trackMany : Maybe a -> Signal (Maybe a) -> Signal (Maybe ( a, Action ))
Signal Bool or
Signal (Maybe a) arguments are the initial value and input signal
which tell whether the mouse is (currently) hovering over something
The library also exposes an Automaton:
type Input a = Mouse MouseEvent | Hover (Maybe a) automaton : Maybe a -> Automaton (Input a) (Maybe ( a, Action ))
(Said automaton is also used internally in the