| 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.Svg.Event
Description
Overview
Miso.Svg.Event provides event-handler Attribute values
for SVG-specific DOM events. All handlers use emptyDecoder
— they fire a fixed action with no payload extracted from the event
object. This module is re-exported by Miso.Svg.
For pointer and keyboard events on SVG elements, use the handlers from Miso.Html.Event directly — they work on any DOM element regardless of namespace.
Quick start
import Miso import Miso.Svg data Action = AnimDone | Zoomed view :: Model ->ViewModel Action view _ =svg_[] [animate_[onEndAnimDone ,onZoomZoomed ] ,circle_[onClickToggle ,onMouseOverHighlight ] ]
Event groups
- Document (fires on
<svg>root):onAbort,onError,onResize,onScroll,onZoom - Graphical (fires on any visible SVG element):
onActivate,onClick,onFocusIn,onFocusOut,onMouseDown,onMouseMove,onMouseOut,onMouseOver,onMouseUp
Note: onClick is re-exported from Miso.Html.Event and is identical
to the HTML version.
See also
- Miso.Html.Event —
onPointerDown,onKeyDown, … work on SVG elements too - Miso.Svg.Element — SVG element constructors
- Miso.Event —
on,emptyDecoderprimitives
Synopsis
- onBegin :: action -> Attribute action
- onEnd :: action -> Attribute action
- onRepeat :: action -> Attribute action
- onAbort :: action -> Attribute action
- onError :: action -> Attribute action
- onResize :: action -> Attribute action
- onScroll :: action -> Attribute action
- onZoom :: action -> Attribute action
- onActivate :: action -> Attribute action
- onClick :: action -> Attribute action
- onFocusIn :: action -> Attribute action
- onFocusOut :: action -> Attribute action
- onMouseDown :: action -> Attribute action
- onMouseMove :: action -> Attribute action
- onMouseOut :: action -> Attribute action
- onMouseOver :: action -> Attribute action
- onMouseUp :: action -> Attribute action
Animation
Document
Graphical
onActivate :: action -> Attribute action Source #
onActivate event
onFocusOut :: action -> Attribute action Source #
onFocusOut event
onMouseDown :: action -> Attribute action Source #
onMouseDown event
onMouseMove :: action -> Attribute action Source #
onMouseMove event
onMouseOut :: action -> Attribute action Source #
onMouseOut event
onMouseOver :: action -> Attribute action Source #
onMouseOver event