meshviewer/lib/map/locationmarker.js

33 lines
993 B
JavaScript
Raw Normal View History

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({
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
this.on('remove', function () {
this._map.removeLayer(this.accuracyCircle);
this._map.removeLayer(this.outerCircle);
});
2015-04-04 17:08:28 +00:00
},
setLatLng: function (latlng) {
this.accuracyCircle.setLatLng(latlng);
this.outerCircle.setLatLng(latlng);
L.CircleMarker.prototype.setLatLng.call(this, latlng);
2015-04-04 17:08:28 +00:00
},
setAccuracy: function (accuracy) {
this.accuracyCircle.setRadius(accuracy);
2015-04-04 17:08:28 +00:00
},
onAdd: function (map) {
this.accuracyCircle.addTo(map).bringToBack();
this.outerCircle.addTo(map);
L.CircleMarker.prototype.onAdd.call(this, map);
2015-04-04 17:08:28 +00:00
}
});
});