Leaflet / Leaflet.draw

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

Dragging the resizing marker cannot change the circle's size #808

Open ahua52 opened 6 years ago

ahua52 commented 6 years ago

How to reproduce

What behaviour I'm expecting and which behaviour I'm seeing

I'm expecting that dragging the marker should change the circle's size. What I see is that the editing markers are moving, but the circle size is not changed.

Minimal example reproducing the issue

Using plunker.

kitzilla commented 6 years ago

I have crashed into the same issue (Leaflet 1.2.0, Leaflet-draw 0.4.13 downloaded with npm)

As a meantime solution, I have patched a minified js in the following way and circle radius now follows the handler for me.

  1. Open node_modules/leaflet-draw/dist/leaflet.draw.js in text editor
  2. Find the following string in the file, there should be only one match radius=this._map.distance(e,t),this._map.fire(L.Draw.Event.EDITRESIZE
  3. Replace this part with radius=this._map.distance(e,t),this._shape.setRadius(radius),this._map.fire(L.Draw.Event.EDITRESIZE

If you are using leaflet.draw-src.js, I think you want to add this._shape.setRadius(radius) to line 2743 If you are building from source, I think you want to add this._shape.setRadius(radius) to line 33 of Edit.Circle.js

Hope this helps

mdomnita commented 6 years ago

I have the same issue with the leaflet-draw from npm. This solution works fine, thanks for it @kitzilla