lib/leaflet.draw/src/draw/handler/Draw.Circle.js in leaflet-js-0.6.beta4 vs lib/leaflet.draw/src/draw/handler/Draw.Circle.js in leaflet-js-0.7.0

- old
+ new

@@ -11,22 +11,24 @@ opacity: 0.5, fill: true, fillColor: null, //same as color by default fillOpacity: 0.2, clickable: true - } + }, + showRadius: true, + metric: true // Whether to use the metric meaurement system or imperial }, initialize: function (map, options) { // Save the type so super can fire, need to do this as cannot do this.TYPE :( this.type = L.Draw.Circle.TYPE; + this._initialLabelText = L.drawLocal.draw.handlers.circle.tooltip.start; + L.Draw.SimpleShape.prototype.initialize.call(this, map, options); }, - _initialLabelText: 'Click and drag to draw circle.', - _drawShape: function (latlng) { if (!this._shape) { this._shape = new L.Circle(this._startLatLng, this._startLatLng.distanceTo(latlng), this.options.shapeOptions); this._map.addLayer(this._shape); } else { @@ -39,21 +41,24 @@ L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this, circle); }, _onMouseMove: function (e) { var latlng = e.latlng, + metric = this.options.metric, + showRadius = this.options.showRadius, + useMetric = this.options.metric, radius; this._tooltip.updatePosition(latlng); if (this._isDrawing) { this._drawShape(latlng); // Get the new radius (rouded to 1 dp) radius = this._shape.getRadius().toFixed(1); this._tooltip.updateContent({ - text: 'Release mouse to finish drawing.', - subtext: 'Radius: ' + radius + ' m' + text: this._endLabelText, + subtext: showRadius ? 'Radius: ' + L.GeometryUtil.readableDistance(radius, useMetric) : '' }); } } -}); \ No newline at end of file +});