portal detail zoom - don't step out for zoom <= 12 - seems to miss some data as we're displaying things larger than the server expects

also, add a new attempt to fix the portal zoom issue (Lundefined) that occurs on mobile sometimes
This commit is contained in:
Jon Atkins 2013-08-27 03:45:37 +01:00
parent de432a0aa3
commit 0302d76a67
2 changed files with 7 additions and 19 deletions

View File

@ -227,24 +227,15 @@ window.reportPortalIssue = function(info) {
window.getPortalDataZoom = function() {
var mapZoom = map.getZoom();
var z = mapZoom;
// make sure we're dealing with an integer here
// (mobile: a float somehow gets through in some cases!)
var z = parseInt(mapZoom);
// limiting the mazimum zoom level for data retrieval reduces the number of requests at high zoom levels
// (as all portal data is retrieved at z=17, why retrieve multiple z=18 tiles when fewer z=17 would do?)
// very effective along with the new cache code
if (z > 17) z=17;
// if the data zoom is above the map zoom we can step back if the detail level is the same
// with the new cache code this works rather well
var minZoom = mapZoom;
// due to the new smaller tiles used for zoom <= 12, we can get away with using further out tiles
// this can mean better use of the cache, and less load on the niantic servers
if (mapZoom <= 12 && mapZoom > 0) minZoom -= 2;
while (z > minZoom && getMinPortalLevelForZoom(z) == getMinPortalLevelForZoom(z-1)) {
z = z-1;
}
//sanity check - should never happen
if (z < 0) z=0;

View File

@ -29,7 +29,9 @@ window.plugin.showMorePortals.setup = function() {
window.getPortalDataZoom = function() {
var mapZoom = map.getZoom();
var z = mapZoom;
// make sure we're dealing with an integer here
// (mobile: a float somehow gets through in some cases!)
var z = parseInt(mapZoom);
// boost data zoom level by one when reasonably close (past the zoom<=12 point of the smaller
// getThinnedEntitiesV4 tiles, to avoid excessive requests further out)
@ -47,12 +49,7 @@ window.plugin.showMorePortals.setup = function() {
// if the data zoom is above the map zoom we can step back if the detail level is the same
// with the new cache code this works rather well
var minZoom = mapZoom;
// due to the new smaller tiles used for zoom <= 12, we can get away with using slightly further out tiles
// this can mean better use of the cache, and less load on the niantic servers
if (mapZoom <= 12 && mapZoom > 0) minZoom -= 2;
while (z > minZoom && getMinPortalLevelForZoom(z) == getMinPortalLevelForZoom(z-1)) {
while (z > mapZoom && getMinPortalLevelForZoom(z) == getMinPortalLevelForZoom(z-1)) {
z = z-1;
}