From 5760f9b7a8093269e2abe43e0d05bbd80c18b37a Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Thu, 25 Jul 2013 02:03:41 +0100 Subject: [PATCH] force rounding to integer the result of map.getZoom() when calculating the map data zoom it's not something that sould happen, but it's been seen on mobile (#271) - this should eliminate the issues with portal data this causes --- code/utils_misc.js | 3 +++ plugins/show-more-portals.user.js | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/code/utils_misc.js b/code/utils_misc.js index 781fd378..9c3020a7 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -247,6 +247,9 @@ window.renderLimitReached = function(ratio) { window.getPortalDataZoom = function() { var z = map.getZoom(); + // on mobile (at least), the map zoom has been non-integer occasionally. fix it. + z = Math.floor(z); + // 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 diff --git a/plugins/show-more-portals.user.js b/plugins/show-more-portals.user.js index 998f33a4..8006ff2e 100644 --- a/plugins/show-more-portals.user.js +++ b/plugins/show-more-portals.user.js @@ -2,7 +2,7 @@ // @id iitc-plugin-show-more-portals@jonatkins // @name IITC plugin: Show more portals // @category Tweaks -// @version 0.1.0.@@DATETIMEVERSION@@ +// @version 0.1.1.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ @@ -29,6 +29,9 @@ window.plugin.showMorePortals.setup = function() { window.getPortalDataZoom = function() { var mapZoom = map.getZoom(); + // on mobile (at least), the map zoom has been non-integer occasionally. fix it. + z = Math.floor(z); + // yes, it is possible to increase this beyond "+1" - however, that will end up producing a rediculous number // of requests to the Niantic servers, giving many request failed errors/tile timeouts // (every increase by one requests four times as many data tiles)