Leaflet / Leaflet.draw

Vector drawing and editing plugin for Leaflet
https://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html
MIT License
1.96k stars 992 forks source link

L.Draw.Circle - leaflet-1.0 compatibility #480

Open JrFolk opened 8 years ago

JrFolk commented 8 years ago

Leaflet-1.0-beta only provides legacy support on the API for L.circle. call but Leaflet.draw, as well as many other plugins, uses the capitalized constructor rather than the API.

I made a PR to address the issue but in the meantime I have tested a workaround for the current stable release (Leaflet 0.7.7) as well as the 1.0-beta/dev branch.

ddproxy commented 8 years ago

Does this equate to a change in L.Draw?

JrFolk commented 8 years ago

Yes, this workaround for L.Draw is tested and ready to go but luckily, my PR to Leaflet was merged promptly and is now live in the Leaflet 1.0-dev branch, so it's only affecting those using L.Draw with Leaflet 1.0 beta 2. I've been using the fix with the current L.Draw release and it works just fine. This is probably a non-issue at this point, and it does break the convention of plugins using the 'L.Constructor'.

I just wanted to touch base with both projects because it caused me a lot of head scratches for the better part of a morning; I wanted to save others the same headache ASAP.

However, I was hoping to discuss the merits of reconstructing the shapes in the event emitters rather than simply returning this._shape or this._poly. I don't think overhead is a concern here at all but it does seem to create the potential for there to be a disconnect between the polygon the user is interacting with vs what gets passed to the event handler.