Skip to content

Commit 780d686

Browse files
Keith BannisterKeith Bannister
authored andcommitted
Fix pan on first detection
1 parent 7967b94 commit 780d686

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ekayak.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ let npositions = 0;
2828

2929
var map = L.map('map').fitWorld();
3030
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
31-
maxZoom: 19,
31+
maxZoom: 21,
3232
attribution: '© OpenStreetMap'
3333
}).addTo(map);
3434
var breadCrumbLine = L.polyline([]).addTo(map);
@@ -39,15 +39,15 @@ function locationSuccess(position) {
3939
locationText.textContent = `lat/long:${c.latitude}/${c.longitude} speed:${c.speed} heading:${c.heading} altitude:${c.altitude} accuracy:${c.accuracy} altaccuracy:${c.altitudeAccuracy} timestamp:${position.timestamp}`;
4040
const latlng = [c.latitude, c.longitude];
4141
if (npositions == 0) {
42-
map.flyTo(latlng, zoomLevel);
42+
map.flyTo(latlng, Number(zoomLevel), {animate:true});
4343
} else {
4444
map.panTo(latlng);
4545
}
4646
breadCrumbLine.addLatLng(latlng);
4747
locationCircle.setLatLng(latlng);
4848
locationCircle.setRadius(c.accuracy);
4949

50-
npositions += 1;
50+
npositions = npositions + 1;
5151
}
5252

5353
function locationError(error) {

0 commit comments

Comments
 (0)