simple fix for global object Map reassignment bug

This commit is contained in:
James Liu 2019-02-27 15:11:31 +08:00 committed by GitHub
parent d4be3b8a25
commit 5a4c1f5798
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,7 +38,7 @@
src="https://maps.googleapis.com/maps/api/js?sensor=true"> src="https://maps.googleapis.com/maps/api/js?sensor=true">
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
Map=null; gMap=null;
CenterLat=45.0; CenterLat=45.0;
CenterLon=9.0; CenterLon=9.0;
Planes={}; Planes={};
@ -123,7 +123,7 @@
} else { } else {
marker = new google.maps.Marker({ marker = new google.maps.Marker({
position: new google.maps.LatLng(plane.lat, plane.lon), position: new google.maps.LatLng(plane.lat, plane.lon),
map: Map, map: gMap,
icon: getIconForPlane(plane) icon: getIconForPlane(plane)
}); });
plane.marker = marker; plane.marker = marker;
@ -156,7 +156,7 @@
zoom: 5, zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP mapTypeId: google.maps.MapTypeId.ROADMAP
}; };
Map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); gMap = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
/* Setup our timer to poll from the server. */ /* Setup our timer to poll from the server. */
window.setInterval(function() { window.setInterval(function() {