WARNING: This package will be merged into elm-pointer-events when the release 0.19 of elm will be out. It won't be updated to elm 0.19.
This package aims at handling mouse events in elm
with more details than in
When dealing with mouse events, I often need to access mouse coordinates.
onMouseDown and others from elm
Html.Events module do not
provide the coordinates of the mouse event.
Thanks to the use of the
on function from
Html.Events and some
custom json decoders, this package provides mouse events with coordinates.
A functional example is available in the
But to have an overview of how to use this package, see below
Msg type and an
Attribute Msg might look like using this Mouse module:
import Mouse type Msg = MouseDown Mouse.Event | MouseMove Mouse.Event | MouseUp Mouse.Event mouseEvents : List (Html.Attribute Msg) mouseEvents = [ Mouse.onDown MouseDown , Mouse.onMove MouseMove , Mouse.onUp MouseUp ]
The attributes kept are:
Go see it's definition in the
Mouse module to know its exact record structure.
The package documentation is available on the elm package website.
This Source Code Form is subject to the terms of the Mozilla Public License,v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
Original author: Matthieu Pizenberg (firstname.lastname@example.org)