2017-01-29 23:51:08 +00:00
|
|
|
define(['leaflet'], function (L) {
|
|
|
|
'use strict';
|
2016-05-27 21:59:01 +00:00
|
|
|
|
2015-04-04 17:08:28 +00:00
|
|
|
return L.CircleMarker.extend({
|
2016-05-22 12:51:30 +00:00
|
|
|
initialize: function (latlng) {
|
2017-11-05 17:23:40 +00:00
|
|
|
this.accuracyCircle = L.circle(latlng, 0, config.locate.accuracyCircle);
|
|
|
|
this.outerCircle = L.circleMarker(latlng, config.locate.outerCircle);
|
|
|
|
L.CircleMarker.prototype.initialize.call(this, latlng, config.locate.innerCircle);
|
2015-04-04 17:08:28 +00:00
|
|
|
|
2017-01-29 23:51:08 +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
|
|
|
});
|
|
|
|
});
|