| Copyright | (C) 2016-2026 David M. Johnson |
|---|---|
| License | BSD3-style (see the file LICENSE) |
| Maintainer | David M. Johnson <code@dmj.io> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Miso.Subscription.Mouse
Contents
Description
Overview
Miso.Subscription.Mouse provides a single global subscription,
mouseSub, that fires on every pointermove event on window,
delivering a PointerEvent carrying coordinates,
pressure, pointer type, and other pointer metadata.
It is a thin convenience wrapper over
.
Use windowSub "pointermove" pointerDecoderwindowPointerMoveSub directly if you
need identical behaviour but prefer the window-level import.
Quick start
import Miso import Miso.Subscription.Mouse import Miso.Event.Types (PointerEvent(..)) data Action = MouseMovedPointerEventsubs :: [SubAction] subs = [mouseSubMouseMoved ] update :: Action ->Effectp props Model Action update (MouseMoved ev) = do let (cx, cy) = client ev -- (clientX, clientY) ...
See also
Synopsis
- mouseSub :: (PointerEvent -> action) -> Sub action
Subscription
Arguments
| :: (PointerEvent -> action) | Callback fired with the full |
| -> Sub action |
Captures mouse coordinates as they occur and writes them to an event sink.