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.
Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/michaelmesser/elm-collage exists but has no tag 1.0.0; Software Heritage has no tag 1.0.0 for it; no fork with tag 1.0.0 found (20 same-name repos checked); no cached copy. Use another version.
Use this module to make your graphics interactive. It is as easy as you think it is.
collage
|> onClick ClickedWill 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 }
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)