joakin / elm-canvas

A canvas drawing library for Elm
https://package.elm-lang.org/packages/joakin/elm-canvas/latest/
BSD 3-Clause "New" or "Revised" License
163 stars 30 forks source link

Canvases get blank on deleting one of them from a List #23

Closed shepelevstas closed 4 years ago

shepelevstas commented 4 years ago

Hello! First of all - Great package!!! Thanks you!!! =D

In my Model I have List {texture:Canvas.Texture, id:Int} when I delete on of textures with { model | textures = List.filter (.id >> (/=) delete_id) model.textures } in update function - all canvases (drawn with List.map drawCanvas model.textures) that have greater id than the deleted one - become blank. They are redrawn as soon as I mouseover one of canvases. Am I doing it wrong? Or is it a bug? Are there any workarounds?

Thank you!

shepelevstas commented 4 years ago

I've found the solution! =D My bad: a noobie mistake - didn't know about Html.Keyed.node and Html.Lazy.lazy!

joakin commented 4 years ago

For the future, I would recommend you post your code to an Ellie when you open an issue, that way it is easier to know what is going on for anyone looking at this 👍