Skip to content

Drawing a circle doesn't work. #450

Open

Description

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.

        _drawShape: function (latlng) {
            if (!this._shape) {
                this.options.shapeOptions.radius = this._startLatLng.distanceTo(latlng);
                this._shape = new L.Circle(this._startLatLng, this.options.shapeOptions);
                this._map.addLayer(this._shape);
            } else {
                this._shape.setRadius(this._startLatLng.distanceTo(latlng));
            }
        },

        _fireCreatedEvent: function () {
            this.options.shapeOptions.radius = this._shape.getRadius();
            var circle = new L.Circle(this._startLatLng, this.options.shapeOptions);
            L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this, circle);
        },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions