Fire the "draw_editstart" event at the second time
See a minimum example for this but: https://github.com/byzheng/leaflet-draw-test
The latest version of leaflet and leaflet.extra packages
Steps to reproduce this bug:
- Run the shiny in the respository
- Click the edit button to edit any circle (the polygon is clear from the map which is expected)
- Save the editing.
- Click the dit button again (the polygon is not clear from the map)
In the second edit, there is NO draw_editstart event.
This could be a limitation/big of the plugin, I will investigate.
@byzheng Could you help me in debugging this? It should be easy to fire up chrome dev tools, and set up break points in the bindings JS file to figure out what exactly is happening?
This could be due to some limitation in how Shiny decides to propagate the event back to the server. I see @jcheng5 has added "nonce" : Math.random() in several Shiny.onInputChange calls in the original leaflet pkg JS code. Perhaps I need to add that for draw events too. THoughts @timelyportfolio ?
Definitely sounds like the repeated-same-events-in-Shiny not getting sent problem https://github.com/daattali/advanced-shiny#message-javascript-r-force. I would generally blame the JS side, but in this case I have not experienced any similar problems with all my work on mapedit.
It might also be that clearGroup does not clear the Leaflet.draw internal mechanism for keeping up with edited features, so Leaflet.draw still thinks the deleted/cleared feature still exists.