leaflet.extras icon indicating copy to clipboard operation
leaflet.extras copied to clipboard

Fire the "draw_editstart" event at the second time

Open byzheng opened this issue 8 years ago • 4 comments

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:

  1. Run the shiny in the respository
  2. Click the edit button to edit any circle (the polygon is clear from the map which is expected)
  3. Save the editing.
  4. Click the dit button again (the polygon is not clear from the map)

In the second edit, there is NO draw_editstart event.

byzheng avatar Jun 26 '17 12:06 byzheng

This could be a limitation/big of the plugin, I will investigate.

bhaskarvk avatar Jun 28 '17 22:06 bhaskarvk

@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?

bhaskarvk avatar Jul 19 '17 16:07 bhaskarvk

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 ?

bhaskarvk avatar Jul 28 '17 12:07 bhaskarvk

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.

timelyportfolio avatar Jul 28 '17 15:07 timelyportfolio