Open Brutusn opened 8 years ago
:+1:
thanks ;-)
Had the same problem, came here with the same intent but you beat me to the punch. I have one remark on the proposed solution. Adding the radius
property to the shapeOptions
object in the _drawShape
method is unnecessary since L.Circle
which is extended from L.CircleMarker
has a default radius: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/CircleMarker.js#L9
Well if I remove that radius option it generates some weird behaviour. It will use the radius of the last circle drawn as a start, and then it will have the correct size.
Weird behaviour? Please elaborate. Instanciating a L.Circle with no radius option in the optionsobject should work just fine.
It will shortly use the radius of the last circle. After that it will get the new radius calculated from the mouseposition.
Absolutely right, didn't notice, thanks!
Why hasn't this update been added to the latest version that is on the master branch(think it is beta)? Or did I download the wrong one?
@Nick-t-go Leaflet.draw doesn't fully support Leaflet 1.x yet. I see iH8's commit but I don't see any pull requests for this from @iH8. His repository also seems to be out of date.
The projected release for 1.x support (and dropping older versions) is 0.5.
The Leaflet-master branch seems to be where most 1.x support has been merged.
I updated Leaflet to the latest dev version. In that version they changed L.Circle and added the radius to the options. I changed that inside the draw plugin inside L.Draw.Circle in the following two functions.