Completed
Push — develop ( cc18e5...2c7500 )
by Xaver
38s
created

locationmarker.js ➔ define   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 32
rs 8.8571
nop 1

4 Functions

Rating   Name   Duplication   Size   Complexity  
A locationmarker.js ➔ ... ➔ L.CircleMarker.extend.setLatLng 0 5 1
A locationmarker.js ➔ ... ➔ L.CircleMarker.extend.initialize 0 10 1
A locationmarker.js ➔ ... ➔ L.CircleMarker.extend.onAdd 0 5 1
A locationmarker.js ➔ ... ➔ L.CircleMarker.extend.setAccuracy 0 3 1
1
define(['leaflet'], function (L) {
2
  'use strict';
3
4
  return L.CircleMarker.extend({
5
    initialize: function (latlng) {
6
      this.accuracyCircle = L.circle(latlng, 0, config.locate.accuracyCircle);
7
      this.outerCircle = L.circleMarker(latlng, config.locate.outerCircle);
8
      L.CircleMarker.prototype.initialize.call(this, latlng, config.locate.innerCircle);
9
10
      this.on('remove', function () {
11
        this._map.removeLayer(this.accuracyCircle);
12
        this._map.removeLayer(this.outerCircle);
13
      });
14
    },
15
16
    setLatLng: function (latlng) {
17
      this.accuracyCircle.setLatLng(latlng);
18
      this.outerCircle.setLatLng(latlng);
19
      L.CircleMarker.prototype.setLatLng.call(this, latlng);
20
    },
21
22
    setAccuracy: function (accuracy) {
23
      this.accuracyCircle.setRadius(accuracy);
24
    },
25
26
    onAdd: function (map) {
27
      this.accuracyCircle.addTo(map).bringToBack();
28
      this.outerCircle.addTo(map);
29
      L.CircleMarker.prototype.onAdd.call(this, map);
30
    }
31
  });
32
});
33