2015-04-04 17:08:28 +00:00
|
|
|
define(["leaflet"], function (L) {
|
2016-05-27 21:59:01 +00:00
|
|
|
"use strict";
|
|
|
|
|
2015-04-04 17:08:28 +00:00
|
|
|
return L.CircleMarker.extend({
|
|
|
|
outerCircle: {
|
|
|
|
stroke: false,
|
|
|
|
color: "#4285F4",
|
|
|
|
opacity: 1,
|
|
|
|
fillOpacity: 0.3,
|
|
|
|
clickable: false,
|
|
|
|
radius: 16
|
|
|
|
},
|
|
|
|
|
|
|
|
innerCircle: {
|
|
|
|
stroke: true,
|
|
|
|
color: "#ffffff",
|
|
|
|
fillColor: "#4285F4",
|
|
|
|
weight: 1.5,
|
|
|
|
clickable: false,
|
|
|
|
opacity: 1,
|
|
|
|
fillOpacity: 1,
|
|
|
|
radius: 7
|
|
|
|
},
|
|
|
|
|
|
|
|
accuracyCircle: {
|
|
|
|
stroke: true,
|
|
|
|
color: "#4285F4",
|
|
|
|
weight: 1,
|
|
|
|
clickable: false,
|
|
|
|
opacity: 0.7,
|
|
|
|
fillOpacity: 0.2
|
|
|
|
},
|
|
|
|
|
2016-05-22 12:51:30 +00:00
|
|
|
initialize: function (latlng) {
|
2016-05-22 11:23:43 +00:00
|
|
|
this.accuracyCircle = L.circle(latlng, 0, this.accuracyCircle);
|
|
|
|
this.outerCircle = L.circleMarker(latlng, this.outerCircle);
|
|
|
|
L.CircleMarker.prototype.initialize.call(this, latlng, this.innerCircle);
|
2015-04-04 17:08:28 +00:00
|
|
|
|
2016-05-22 12:51:30 +00:00
|
|
|
this.on("remove", function () {
|
2016-05-22 11:23:43 +00:00
|
|
|
this._map.removeLayer(this.accuracyCircle);
|
|
|
|
this._map.removeLayer(this.outerCircle);
|
|
|
|
});
|
2015-04-04 17:08:28 +00:00
|
|
|
},
|
|
|
|
|
2016-05-22 12:51:30 +00:00
|
|
|
setLatLng: function (latlng) {
|
2016-05-22 11:23:43 +00:00
|
|
|
this.accuracyCircle.setLatLng(latlng);
|
|
|
|
this.outerCircle.setLatLng(latlng);
|
|
|
|
L.CircleMarker.prototype.setLatLng.call(this, latlng);
|
2015-04-04 17:08:28 +00:00
|
|
|
},
|
|
|
|
|
2016-05-22 12:51:30 +00:00
|
|
|
setAccuracy: function (accuracy) {
|
2016-05-22 11:23:43 +00:00
|
|
|
this.accuracyCircle.setRadius(accuracy);
|
2015-04-04 17:08:28 +00:00
|
|
|
},
|
|
|
|
|
2016-05-22 12:51:30 +00:00
|
|
|
onAdd: function (map) {
|
2016-05-22 11:23:43 +00:00
|
|
|
this.accuracyCircle.addTo(map).bringToBack();
|
|
|
|
this.outerCircle.addTo(map);
|
|
|
|
L.CircleMarker.prototype.onAdd.call(this, map);
|
2015-04-04 17:08:28 +00:00
|
|
|
}
|
2016-05-22 11:23:43 +00:00
|
|
|
});
|
|
|
|
});
|