mirror of
https://github.com/jketterl/openwebrx.git
synced 2026-04-04 14:08:38 +00:00
improve update pipeline; remove expired markers
This commit is contained in:
parent
1828c4fc96
commit
71eee49fe2
2 changed files with 43 additions and 16 deletions
|
|
@ -114,8 +114,10 @@ $(function(){
|
|||
|
||||
switch (update.location.type) {
|
||||
case 'latlon':
|
||||
if (!update.location.lat || !update.location.lon) break;
|
||||
var pos = new google.maps.LatLng(update.location.lat, update.location.lon);
|
||||
var pos = false;
|
||||
if (update.location.lat && update.location.lon) {
|
||||
pos = new google.maps.LatLng(update.location.lat, update.location.lon);
|
||||
}
|
||||
var marker;
|
||||
var markerClass = google.maps.Marker;
|
||||
var aprsOptions = {}
|
||||
|
|
@ -130,13 +132,21 @@ $(function(){
|
|||
}
|
||||
if (markers[key]) {
|
||||
marker = markers[key];
|
||||
if (!pos) {
|
||||
delete markers[key];
|
||||
marker.setMap();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
marker = new markerClass();
|
||||
marker.addListener('click', function(){
|
||||
showMarkerInfoWindow(update.source, pos);
|
||||
});
|
||||
markers[key] = marker;
|
||||
if (pos) {
|
||||
marker = new markerClass();
|
||||
marker.addListener('click', function () {
|
||||
showMarkerInfoWindow(update.source, pos);
|
||||
});
|
||||
markers[key] = marker;
|
||||
}
|
||||
}
|
||||
if (!marker) return;
|
||||
marker.setOptions($.extend({
|
||||
position: pos,
|
||||
map: map,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue