2426021684/elm-collage/1.0.2

Renamed to michaelmesser/elm-collage. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as 2426021684/elm-collage still install under that name. 2 versions of 3 come from the new location (see their notes). 1 version could not be recovered and cannot be installed.

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/michaelmesser/elm-collage.

What we checked: The repo moved to github.com/michaelmesser/elm-collage. Rebuilt with git archive from commit 020c931a239a of https://github.com/michaelmesser/elm-collage (zip prefix 2426021684-elm-collage-da87c20/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 6b376dc246549b4beabe34c1cc544fd1ed5bd5a5.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/2426021684/elm-collage/zipball/1.0.2/

Collage.Events

Use this module to make your graphics interactive. It is as easy as you think it is.

collage
  |> onClick Clicked

Will send the message Clicked to your update function where you can handle it. You will probably need some way to identify your objects to keep track of which object the user clicked on:

drawing.collage
  |> onClick (ClickedOn drawing.id)

where drawing : { r | collage : Collage, id : Id }

Contents

Mouse events

onClick : msg -> Collage msg -> Collage msg
onDoubleClick : msg -> Collage msg -> Collage msg
onMouseDown : (Point -> msg) -> Collage msg -> Collage msg
onMouseUp : (Point -> msg) -> Collage msg -> Collage msg
onMouseMove : (Point -> msg) -> Collage msg -> Collage msg
onMouseEnter : (Point -> msg) -> Collage msg -> Collage msg
onMouseLeave : (Point -> msg) -> Collage msg -> Collage msg
onMouseOver : (Point -> msg) -> Collage msg -> Collage msg
onMouseOut : (Point -> msg) -> Collage msg -> Collage msg

Focus events

onFocusIn : msg -> Collage msg -> Collage msg
onFocusOut : msg -> Collage msg -> Collage msg

Custom events

on : String -> Decoder msg -> Collage msg -> Collage msg

Adds a custom event handler to a collage.

The first argument specifies the event name (as you would give it to JavaScript's addEventListener). The second argument will be used to decode the Json response from the event listener. If the decoder succeeds, the resulting message will be passed along to your update function.

onClick : msg -> Collage msg -> Collage msg
onClick msg =
  on "click" (Json.succeed msg)