1
0
Fork 0

Phi: draw aircraft trail on map widget

This commit is contained in:
Torsten Dreyer 2015-02-13 16:50:29 +01:00
parent ca3510aac1
commit 702cd2c8ea

View file

@ -110,6 +110,10 @@ define(
aircraftMarker.addTo(self.map);
var aircraftTrack = L.polyline([], {
color : 'red'
}).addTo(self.map);
self.latitude = ko.observable(0).extend({
fgprop : 'latitude'
});
@ -142,10 +146,18 @@ define(
rateLimit : 2000
});
self.aircraftTrailLength = 60;
self.mapCenter.subscribe(function(newValue) {
if (self.followAircraft()) {
self.map.setView(newValue);
}
var trail = aircraftTrack.getLatLngs();
while (trail.length > self.aircraftTrailLength)
trail.shift();
trail.push(newValue);
aircraftTrack.setLatLngs(trail);
});
}