-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.js
31 lines (28 loc) · 1.04 KB
/
map.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var map;
DG.then(function () {
map = DG.map('map', {
center: [56.8662, 53.1891],
zoom: 13
});
DG.control.location({ locateOptions: { setView: false, watch: true } }).addTo(map);
getPointsState();
renderMarkers(map, interestingPoints);
map.locate({ setView: false, watch: true })
.on('locationfound', function (userLocation) {
var points = findNearestPoints(userLocation, interestingPoints, 20);
// for demo
/*
var index = Math.random() * (0 - interestingPoints.length - 5) + 0;
var points = interestingPoints.slice(index, index + 5);
console.log(points);
*/
renderVisitedMarkers(map, points);
updateProgressBar();
})
.on('locationerror', function (e) {
var popup = DG.popup()
.setLatLng(map.getCenter())
.setContent('Доступ к определению местоположения отключён')
.openOn(map);
});
});