Conditions | 1 |
Paths | 1 |
Total Lines | 36 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | define(['leaflet'], function (L) { |
||
2 | 'use strict'; |
||
3 | |||
4 | return L.CircleMarker.extend({ |
||
5 | outerCircle: config.locate.outerCircle, |
||
6 | innerCircle: config.locate.innerCircle, |
||
7 | accuracyCircle: config.locate.accuracyCircle, |
||
8 | |||
9 | initialize: function (latlng) { |
||
10 | this.accuracyCircle = L.circle(latlng, 0, this.accuracyCircle); |
||
11 | this.outerCircle = L.circleMarker(latlng, this.outerCircle); |
||
12 | L.CircleMarker.prototype.initialize.call(this, latlng, this.innerCircle); |
||
13 | |||
14 | this.on('remove', function () { |
||
15 | this._map.removeLayer(this.accuracyCircle); |
||
16 | this._map.removeLayer(this.outerCircle); |
||
17 | }); |
||
18 | }, |
||
19 | |||
20 | setLatLng: function (latlng) { |
||
21 | this.accuracyCircle.setLatLng(latlng); |
||
22 | this.outerCircle.setLatLng(latlng); |
||
23 | L.CircleMarker.prototype.setLatLng.call(this, latlng); |
||
24 | }, |
||
25 | |||
26 | setAccuracy: function (accuracy) { |
||
27 | this.accuracyCircle.setRadius(accuracy); |
||
28 | }, |
||
29 | |||
30 | onAdd: function (map) { |
||
31 | this.accuracyCircle.addTo(map).bringToBack(); |
||
32 | this.outerCircle.addTo(map); |
||
33 | L.CircleMarker.prototype.onAdd.call(this, map); |
||
34 | } |
||
35 | }); |
||
36 | }); |
||
37 |