vendor: 2,254 bytes, lines 1-83
1/** 2 * @class L.Draw.Circle 3 * @aka Draw.Circle 4 * @inherits L.Draw.SimpleShape 5 */ 6L.Draw.Circle = L.Draw.SimpleShape.extend({ 7 statics: { 8 TYPE: 'circle' 9 }, 10 11 options: { 12 shapeOptions: { 13 stroke: true, 14 color: '#3388ff', 15 weight: 4, 16 opacity: 0.5, 17 fill: true, 18 fillColor: null, //same as color by default 19 fillOpacity: 0.2, 20 clickable: true 21 }, 22 showRadius: true, 23 metric: true, // Whether to use the metric measurement system or imperial 24 feet: true, // When not metric, use feet instead of yards for display 25 nautic: false // When not metric, not feet use nautic mile for display 26 }, 27 28 // @method initialize(): void 29 initialize: function (map, options) { 30 // Save the type so super can fire, need to do this as cannot do this.TYPE :( 31 this.type = L.Draw.Circle.TYPE; 32 33 this._initialLabelText = L.drawLocal.draw.handlers.circle.tooltip.start; 34 35 L.Draw.SimpleShape.prototype.initialize.call(this, map, options); 36 }, 37 38 _drawShape: function (latlng) { 39 // Calculate the distance based on the version 40 if (L.GeometryUtil.isVersion07x()) { 41 var distance = this._startLatLng.distanceTo(latlng); 42 } else { 43 var distance = this._map.distance(this._startLatLng, latlng); 44 } 45 46 if (!this._shape) { 47 this._shape = new L.Circle(this._startLatLng, distance, this.options.shapeOptions); 48 this._map.addLayer(this._shape); 49 } else { 50 this._shape.setRadius(distance); 51 } 52 }, 53 54 _fireCreatedEvent: function () { 55 var circle = new L.Circle(this._startLatLng, this._shape.getRadius(), this.options.shapeOptions); 56 L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this, circle); 57 }, 58 59 _onMouseMove: function (e) { 60 var latlng = e.latlng, 61 showRadius = this.options.showRadius, 62 useMetric = this.options.metric, 63 radius; 64 65 this._tooltip.updatePosition(latlng); 66 if (this._isDrawing) { 67 this._drawShape(latlng); 68 69 // Get the new radius (rounded to 1 dp) 70 radius = this._shape.getRadius().toFixed(1); 71 72 var subtext = ''; 73 if (showRadius) { 74 subtext = L.drawLocal.draw.handlers.circle.radius + ': ' + 75 L.GeometryUtil.readableDistance(radius, useMetric, this.options.feet, this.options.nautic); 76 } 77 this._tooltip.updateContent({ 78 text: this._endLabelText, 79 subtext: subtext 80 }); 81 } 82 } 83});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.