diff --git a/code/map_data_calc_tools.js b/code/map_data_calc_tools.js index 047d3381..db51b1ac 100755 --- a/code/map_data_calc_tools.js +++ b/code/map_data_calc_tools.js @@ -15,9 +15,15 @@ window.setupDataTileParams = function() { var DEFAULT_ZOOM_TO_TILES_PER_EDGE = [60, 60, 60, 60, 60, 120, 500, 500, 2000, 4000, 4000, 8000, 32000, 64000]; var DEFAULT_ZOOM_TO_LEVEL = [8,8,8,8,7,7,7,6,6,5,4,4,3,2,2,1,1]; + // stock intel doesn't have this array (they use a switch statement instead), but this is far neater + var DEFAULT_ZOOM_TO_LINK_LENGTH = [200000,200000,200000,200000,200000,60000,60000,10000,5000,2500,2500,800,300,0,0]; window.TILE_PARAMS = {}; + // not in stock to detect - we'll have to assume the above values... + window.TILE_PARAMS.ZOOM_TO_LINK_LENGTH = DEFAULT_ZOOM_TO_LINK_LENGTH; + + if (niantic_params.ZOOM_TO_LEVEL && niantic_params.TILES_PER_EDGE) { window.TILE_PARAMS.ZOOM_TO_LEVEL = niantic_params.ZOOM_TO_LEVEL; window.TILE_PARAMS.TILES_PER_EDGE = niantic_params.TILES_PER_EDGE; @@ -67,6 +73,8 @@ window.getMapZoomTileParameters = function(zoom) { level: level, maxLevel: window.TILE_PARAMS.ZOOM_TO_LEVEL[zoom] || 0, // for reference, for log purposes, etc tilesPerEdge: window.TILE_PARAMS.TILES_PER_EDGE[zoom] || maxTilesPerEdge, + minLinkLength: window.TILE_PARAMS.ZOOM_TO_LINK_LENGTH[zoom] || 0, + noPortals: zoom < window.TILE_PARAMS.ZOOM_TO_LINK_LENGTH.length, // no portals returned at all when link length limits things zoom: zoom // include the zoom level, for reference }; } diff --git a/code/status_bar.js b/code/status_bar.js index 10dd8858..93a53c89 100644 --- a/code/status_bar.js +++ b/code/status_bar.js @@ -11,36 +11,24 @@ window.renderUpdateStatus = function() { var zoom = map.getZoom(); zoom = getDataZoomForMapZoom(zoom); - - var minLinkLength; - if (zoom <= 4) minLinkLength = 200000; - else if (zoom <= 6) minLinkLength = 60000; - else if (zoom <= 7) minLinkLength = 10000; - else if (zoom <= 8) minLinkLength = 5000; - else if (zoom <= 10) minLinkLength = 2500; - else if (zoom <= 11) minLinkLength = 800; - else if (zoom <= 12) minLinkLength = 300; - else if (zoom <= 14) minLinkLength = 0; // 0 means 'all links, but not all portals' - else minLinkLength = -1; // -1 means 'all links and portals by min level' - - var minlvl = getMinPortalLevel(); - + var tileParams = getMapZoomTileParameters(zoom); var t = ''; - if (minLinkLength == -1) { + if (!tileParams.noPortals) { + // zoom level includes portals (and also all links/fields) if(!window.isSmartphone()) // space is valuable t += 'portals: '; - if(minlvl === 0) + if(tileParams.level === 0) t += 'all'; else - t += 'L'+minlvl+(minlvl<8?'+':'') + ''; + t += 'L'+tileParams.level+(tileParams.level<8?'+':'') + ''; } else { if(!window.isSmartphone()) // space is valuable t += 'links: '; - if (minLinkLength > 0) - t += '>'+(minLinkLength>1000?minLinkLength/1000+'km':minLinkLength+'m')+''; + if (tileParams.minLinkLength > 0) + t += '>'+(tileParams.minLinkLength>1000?tileParams.minLinkLength/1000+'km':tileParams.minLinkLength+'m')+''; else t += 'all links'; }