-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Description
L.Circle manipulates with a wrong radius when CRS.Simple used...
that make problem with the Circle add/editing in the Leaflet.draw
as temporary solution I made quick hack for overwrite projectLatlngs() to use radius without any manipulation:
L.Circle = L.Circle.extend({
projectLatlngs: function () {
//this._point = this._map.latLngToLayerPoint(this._latlng);
//this._radius = this._mRadius;
var lngRadius = this._mRadius,
latlng2 = new L.LatLng(this._latlng.lat, this._latlng.lng - lngRadius),
point2 = this._map.latLngToLayerPoint(latlng2);
this._point = this._map.latLngToLayerPoint(this._latlng);
this._radius = Math.max(Math.round(this._point.x - point2.x), 1);
},
getBounds: function () {
var radius = this._mRadius,
latlng = this._latlng,
sw = new L.LatLng(latlng.lat - radius, latlng.lng - radius),
ne = new L.LatLng(latlng.lat + radius, latlng.lng + radius);
return new L.LatLngBounds(sw, ne);
}
});