|
|
|
|
@ -28,6 +28,10 @@
|
|
|
|
|
center: {lat: 39.144684, lng: -84.510079},
|
|
|
|
|
zoom: 5
|
|
|
|
|
});
|
|
|
|
|
google.maps.event.addListener(map, 'center_changed', function() {
|
|
|
|
|
checkBounds(map);
|
|
|
|
|
});
|
|
|
|
|
map.setOptions({ minZoom: 2, maxZoom: 18});
|
|
|
|
|
|
|
|
|
|
new google.maps.Marker({
|
|
|
|
|
position: {lat: 39.144684, lng: -84.510079},
|
|
|
|
|
@ -42,6 +46,12 @@
|
|
|
|
|
zoom: 5
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
google.maps.event.addListener(map, 'center_changed', function() {
|
|
|
|
|
checkBounds(map);
|
|
|
|
|
});
|
|
|
|
|
map.setOptions({ minZoom: 2, maxZoom: 18});
|
|
|
|
|
|
|
|
|
|
new google.maps.Marker({
|
|
|
|
|
position: position[0],
|
|
|
|
|
map: map,
|
|
|
|
|
@ -54,6 +64,11 @@
|
|
|
|
|
center: positions[0],
|
|
|
|
|
zoom: 5
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
google.maps.event.addListener(map, 'center_changed', function() {
|
|
|
|
|
checkBounds(map);
|
|
|
|
|
});
|
|
|
|
|
map.setOptions({ minZoom: 2, maxZoom: 18});
|
|
|
|
|
for (var i = 0; i < positions.length; i ++) {
|
|
|
|
|
new google.maps.Marker({
|
|
|
|
|
position: positions[i][0],
|
|
|
|
|
@ -69,6 +84,11 @@
|
|
|
|
|
center: {lat: 39.144684, lng: -84.510079},
|
|
|
|
|
zoom: 15
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
google.maps.event.addListener(map, 'center_changed', function() {
|
|
|
|
|
checkBounds(map);
|
|
|
|
|
});
|
|
|
|
|
map.setOptions({ minZoom: 2, maxZoom: 18});
|
|
|
|
|
// CLEAR EXISTING MARKERS
|
|
|
|
|
if (marker1 !== undefined && marker2 !== undefined && path !== undefined) {
|
|
|
|
|
marker1.setMap(null);
|
|
|
|
|
@ -110,6 +130,11 @@
|
|
|
|
|
center: {lat: 0, lng: 0},
|
|
|
|
|
zoom: 5
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
google.maps.event.addListener(map, 'center_changed', function() {
|
|
|
|
|
checkBounds(map);
|
|
|
|
|
});
|
|
|
|
|
map.setOptions({ minZoom: 2, maxZoom: 18});
|
|
|
|
|
for (var i = 0; i < flightPaths.length; i++) {
|
|
|
|
|
var tempMarker1 = null;
|
|
|
|
|
var tempMarker2 = null;
|
|
|
|
|
@ -165,6 +190,31 @@
|
|
|
|
|
|
|
|
|
|
map.fitBounds(bounds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function checkBounds(map) {
|
|
|
|
|
|
|
|
|
|
var latNorth = map.getBounds().getNorthEast().lat();
|
|
|
|
|
var latSouth = map.getBounds().getSouthWest().lat();
|
|
|
|
|
var newLat;
|
|
|
|
|
|
|
|
|
|
if(latNorth<85 && latSouth>-85) /* in both side -> it's ok */
|
|
|
|
|
return;
|
|
|
|
|
else {
|
|
|
|
|
if(latNorth>85 && latSouth<-85) /* out both side -> it's ok */
|
|
|
|
|
return;
|
|
|
|
|
else {
|
|
|
|
|
if(latNorth>85)
|
|
|
|
|
newLat = map.getCenter().lat() - (latNorth-85); /* too north, centering */
|
|
|
|
|
if(latSouth<-85)
|
|
|
|
|
newLat = map.getCenter().lat() - (latSouth+85); /* too south, centering */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//re-centre the map
|
|
|
|
|
if(newLat) {
|
|
|
|
|
var newCenter= new google.maps.LatLng( newLat ,map.getCenter().lng() );
|
|
|
|
|
map.setCenter(newCenter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBnt2PJyKZsh-qrsTkbZwSGuUNWPromlLg&callback=initMap" defer></script>
|
|
|
|
|
</body>
|
|
|
|
|
|