remove restrictions on zoom in getPosition. instead, after a defaault base layer is set, use setZoom(getZoom) to ensure zoom level is valid for this base map
This commit is contained in:
parent
653a6cc82d
commit
7b574b9ea1
@ -253,6 +253,12 @@ window.setMapBaseLayer = function() {
|
|||||||
var baseLayer = nameToLayer[localStorage['iitc-base-map']] || firstLayer;
|
var baseLayer = nameToLayer[localStorage['iitc-base-map']] || firstLayer;
|
||||||
map.addLayer(baseLayer);
|
map.addLayer(baseLayer);
|
||||||
|
|
||||||
|
//after choosing a base layer, ensure the zoom is valid for this layer
|
||||||
|
//(needs to be done here - as we don't know the base layer zoom limit before this)
|
||||||
|
map.setZoom(map.getZoom());
|
||||||
|
|
||||||
|
|
||||||
|
//event to track layer changes and store the name
|
||||||
map.on('baselayerchange', function() {
|
map.on('baselayerchange', function() {
|
||||||
for(i in window.layerChooser._layers) {
|
for(i in window.layerChooser._layers) {
|
||||||
var obj = window.layerChooser._layers[i];
|
var obj = window.layerChooser._layers[i];
|
||||||
@ -264,6 +270,7 @@ window.setMapBaseLayer = function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// renders player details into the website. Since the player info is
|
// renders player details into the website. Since the player info is
|
||||||
|
@ -25,7 +25,7 @@ window.getPosition = function() {
|
|||||||
var lat = parseInt(getURLParam('latE6'))/1E6 || 0.0;
|
var lat = parseInt(getURLParam('latE6'))/1E6 || 0.0;
|
||||||
var lng = parseInt(getURLParam('lngE6'))/1E6 || 0.0;
|
var lng = parseInt(getURLParam('lngE6'))/1E6 || 0.0;
|
||||||
var z = parseInt(getURLParam('z')) || 17;
|
var z = parseInt(getURLParam('z')) || 17;
|
||||||
return {center: new L.LatLng(lat, lng), zoom: z > 18 ? 18 : z};
|
return {center: new L.LatLng(lat, lng), zoom: z};
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getURLParam('ll')) {
|
if(getURLParam('ll')) {
|
||||||
@ -33,7 +33,7 @@ window.getPosition = function() {
|
|||||||
var lat = parseFloat(getURLParam('ll').split(",")[0]) || 0.0;
|
var lat = parseFloat(getURLParam('ll').split(",")[0]) || 0.0;
|
||||||
var lng = parseFloat(getURLParam('ll').split(",")[1]) || 0.0;
|
var lng = parseFloat(getURLParam('ll').split(",")[1]) || 0.0;
|
||||||
var z = parseInt(getURLParam('z')) || 17;
|
var z = parseInt(getURLParam('z')) || 17;
|
||||||
return {center: new L.LatLng(lat, lng), zoom: z > 18 ? 18 : z};
|
return {center: new L.LatLng(lat, lng), zoom: z};
|
||||||
}
|
}
|
||||||
|
|
||||||
if(readCookie('ingress.intelmap.lat') && readCookie('ingress.intelmap.lng')) {
|
if(readCookie('ingress.intelmap.lat') && readCookie('ingress.intelmap.lng')) {
|
||||||
@ -45,10 +45,10 @@ window.getPosition = function() {
|
|||||||
if(lat < -90 || lat > 90) lat = 0.0;
|
if(lat < -90 || lat > 90) lat = 0.0;
|
||||||
if(lng < -180 || lng > 180) lng = 0.0;
|
if(lng < -180 || lng > 180) lng = 0.0;
|
||||||
|
|
||||||
return {center: new L.LatLng(lat, lng), zoom: z > 18 ? 18 : z};
|
return {center: new L.LatLng(lat, lng), zoom: z};
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout("window.map.locate({setView : true, maxZoom: 13});", 50);
|
setTimeout("window.map.locate({setView : true});", 50);
|
||||||
|
|
||||||
return {center: new L.LatLng(0.0, 0.0), zoom: 1};
|
return {center: new L.LatLng(0.0, 0.0), zoom: 1};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user